From patchwork Tue Dec 17 17:44:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jason A. Donenfeld" X-Patchwork-Id: 181894 Delivered-To: patch@linaro.org Received: by 2002:ac9:44c4:0:0:0:0:0 with SMTP id t4csp6014247och; Tue, 17 Dec 2019 09:45:08 -0800 (PST) X-Google-Smtp-Source: APXvYqxNNnCGSXxyXvFAc8JHS8LtcOq0BmUzkxWbCRVyCR2eMNE0ptN5aku6iPHNG9WZWjZOJOfN X-Received: by 2002:a9d:2965:: with SMTP id d92mr6711037otb.175.1576604708455; Tue, 17 Dec 2019 09:45:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576604708; cv=none; d=google.com; s=arc-20160816; b=neOMw78z0cTIujT+ZJv++UyXhUNI6iNp03BC5cRsgPJOHs76f94p4ukvrpzw4H79TF yA8uk7Q0UoNAxwqwlKpLNahbCbMX2M7Pqk3qzf/RW8f+7I+H8bi/MV0E7s9GoMlqn5n8 BjnXbW+5aj4JmTxtqu+oM2vyXcH+0WKZ0wjKVVnlWonUQuVwcs61pjqqr3FRTi48+jtx kqVrMrRSR5LtuxgmvYIwX7abHlrUIYV4HMdh7Qqi5YXB2tjiv3aBA0MnRjoSvm/ex1Dp gjIl8+VLszkJW1nmGIo62vpuA2l2MpO4ERtPydjFEprznw5eZ7Rk0qtOMZNBmlN6x5kZ 8Hmg== 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=qvZHtDODThdOsa7PdHOVuHwQrj7M2QCb4M833imhHxU=; b=lSIIr4+IxTHPBOB7JXe5SMz7sa9Gmv2vQgm4Ifl9FYyMZjfxoOiL4kL04Xt8jj1Zam pSD/QjiUUJPg03zIG4/QoNNhJiWynNufyYLl5DU6ZfBJXLRTp78i4gx35kce2xbHPnHN nmPys5Fd8dfBqMDKqlsbmMEg3669ALiMOGWKDQVCEnu+o3JDbNRYCHIWkpmoWXD3JLkC GYvL8yw+ftvJjvJ5IxStjQ6VYIqsjleDZLR0ol1HDw46BmxFRpu5M+69MoziIwkXXXbr jnlYs3Jd4/91dk1VXsX4Zm5knD8oBSyLBZBP64ZD0WrH81geGu6b7RafHijJzwehCZdy nBwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zx2c4.com header.s=mail header.b=qezczTMW; 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=zx2c4.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i198si12781196oib.111.2019.12.17.09.45.08; Tue, 17 Dec 2019 09:45:08 -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=@zx2c4.com header.s=mail header.b=qezczTMW; 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=zx2c4.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726885AbfLQRpH (ORCPT + 3 others); Tue, 17 Dec 2019 12:45:07 -0500 Received: from frisell.zx2c4.com ([192.95.5.64]:58961 "EHLO frisell.zx2c4.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726764AbfLQRpH (ORCPT ); Tue, 17 Dec 2019 12:45:07 -0500 Received: by frisell.zx2c4.com (ZX2C4 Mail Server) with ESMTP id 6faac496; Tue, 17 Dec 2019 16:48:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=zx2c4.com; h=from:to:cc :subject:date:message-id:mime-version:content-type :content-transfer-encoding; s=mail; bh=44FlwhW4PpeUr02PKp+k6qGGR gQ=; b=qezczTMWy6NtQqM9SoZ6UV5tsuEm+M+QcSjHdBMiWERu/ippNpX3bQawJ YsYYStyBUdE6cHsNbLg4bW1mufwJXzIENpMPXpwsK5JMaZIpDHYGI4Vkb/OcAu11 iF6HZu2mgHEA5dn3VF9RVWw5Hi/bm9wNpd3kSgyj+XIkJVnAzkEhU55RAzfG+DU+ 7liGyge8eOcmZ5KA8inLKYtJye+3oEIwXA4UNNPIGwgmt5IVnn9z3v5xF+qjzjG5 qfOPC/UhmeSEj+QSLCxoFRrt8A5tdgVvQyjqR3FPOdaPwEyLQXGfp0pEAzR6SJXw snFgHYx70OiHHtR/AKDbJJvp0GQQQ== Received: by frisell.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id d7ec19b1 (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256:NO); Tue, 17 Dec 2019 16:48:38 +0000 (UTC) From: "Jason A. Donenfeld" To: linux-crypto@vger.kernel.org, herbert@gondor.apana.org.au Cc: "Jason A. Donenfeld" , Eric Biggers , Ard Biesheuvel Subject: [PATCH crypto-next v6 0/3] crypto: poly1305 improvements Date: Tue, 17 Dec 2019 18:44:42 +0100 Message-Id: <20191217174445.188216-1-Jason@zx2c4.com> MIME-Version: 1.0 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org With no feedback on v5 beyond the need for a .gitignore in the second commit of this v6, I think this series should now be good to go. These are some improvements to the Poly1305 code that I think should be fairly uncontroversial. The first part, the new C implementations, adds cleaner code in two forms that can easily be compared and reviewed, and also results in performance speedups. The second part, the new x86_64 implementation, replaces an slow unvetted implementation with an extremely fast implementation that has received many eyeballs. Finally, we fix up some deadcode. Cc: Eric Biggers Cc: Ard Biesheuvel Jason A. Donenfeld (3): crypto: poly1305 - add new 32 and 64-bit generic versions crypto: x86_64/poly1305 - add faster implementations crypto: arm/arm64/mips/poly1305 - remove redundant non-reduction from emit arch/arm/crypto/poly1305-glue.c | 18 +- arch/arm64/crypto/poly1305-glue.c | 18 +- arch/mips/crypto/poly1305-glue.c | 18 +- arch/x86/crypto/.gitignore | 1 + arch/x86/crypto/Makefile | 11 +- arch/x86/crypto/poly1305-avx2-x86_64.S | 390 --- arch/x86/crypto/poly1305-sse2-x86_64.S | 590 ---- arch/x86/crypto/poly1305-x86_64.pl | 4266 ++++++++++++++++++++++++ arch/x86/crypto/poly1305_glue.c | 308 +- crypto/adiantum.c | 4 +- crypto/nhpoly1305.c | 2 +- crypto/poly1305_generic.c | 27 +- include/crypto/internal/poly1305.h | 50 +- include/crypto/nhpoly1305.h | 4 +- include/crypto/poly1305.h | 16 +- lib/crypto/Kconfig | 4 +- lib/crypto/Makefile | 4 +- lib/crypto/poly1305-donna32.c | 204 ++ lib/crypto/poly1305-donna64.c | 185 + lib/crypto/poly1305.c | 174 +- 20 files changed, 4927 insertions(+), 1367 deletions(-) create mode 100644 arch/x86/crypto/.gitignore delete mode 100644 arch/x86/crypto/poly1305-avx2-x86_64.S delete mode 100644 arch/x86/crypto/poly1305-sse2-x86_64.S create mode 100644 arch/x86/crypto/poly1305-x86_64.pl create mode 100644 lib/crypto/poly1305-donna32.c create mode 100644 lib/crypto/poly1305-donna64.c -- 2.24.1