From patchwork Thu Dec 12 17:32:55 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: 181498 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp1192101ile; Thu, 12 Dec 2019 09:33:28 -0800 (PST) X-Google-Smtp-Source: APXvYqwNcjs4ZxxHQauyYJdRz7D9rJ4ij69uEnYNZLMadEM86tlBhvsmEqH1vFfTcqX7j9HwahJ2 X-Received: by 2002:a05:6808:14d:: with SMTP id h13mr6043705oie.58.1576172007956; Thu, 12 Dec 2019 09:33:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576172007; cv=none; d=google.com; s=arc-20160816; b=buoyGzeC8OUqxaT9IjpFjcnRwLFj8XSCtZHlGQtSnWUIEmmuKdxSykY8hihTuFvcEA pu3EnKBNAt7aUeCbmRV5LYrQKlWFv0E0GSoWgkFrl7HcMdQLb+U7AxIjc1ciiOKYrJc3 w6sJ9QxgPwemYxIg8llyaV6feUFqfhZgYALdlpqtPBsqpGAcfSE2DMoG140i8ZNF1g7t ry6ixA8t/NU4ER5kHtvb0OKPtMT9QPokdx/19Lrsis6XB5YOyIDHdc2VStZF+1v25LXF XGkfKyaO/+Hhpyc7lT5fn/zhysVIckkbq61NViN6l23qiW7t/JUfCtANidOEXMkIXzsg ZSvg== 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=ITDPMbC6dFILg7rk2ih1C6dpna7XK9V8rLny5JI2RCU=; b=ve07Me6ffMDg1RyrJMnw9k1LILzhR8ZlcLsZs9DBqVqLGc1EFa9VMkEK7oLF94s7mw Ke+1CB8GgVsTG4aPqBylBKxqHoMoa1gJhsoN09dyyNeVO6EBkEdMIy5EyIomspeBF2CU DuMzkW1CnYvZo/xZaindjXck43qKm/JBYL5RA25ZW45AoPGcVoqd66zavCvjHen1335G T8H0UY2re8bLuyvsmuhuNq6SZ90pzBO72pax7xQzjT3BniwNZFYgAyeGWp/CuXb81S4c UmL9789u62sWBnqCOFMED+lGam6WBw+uhbAnBxrpD2URgU/fv2Fv4BNRp/iX+qZxKsei q9mA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zx2c4.com header.s=mail header.b=j1POZeWx; 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 m85si3463676oig.158.2019.12.12.09.33.27; Thu, 12 Dec 2019 09:33:27 -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=j1POZeWx; 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 S1730194AbfLLRd1 (ORCPT + 3 others); Thu, 12 Dec 2019 12:33:27 -0500 Received: from frisell.zx2c4.com ([192.95.5.64]:37805 "EHLO frisell.zx2c4.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730184AbfLLRd1 (ORCPT ); Thu, 12 Dec 2019 12:33:27 -0500 Received: by frisell.zx2c4.com (ZX2C4 Mail Server) with ESMTP id 9033b94b; Thu, 12 Dec 2019 16:37:37 +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=Os7qTnEKiPL6WvUkdr4L/buUy Aw=; b=j1POZeWxWP3q3dMF9s9sUvdPCxO7ydL156CoZpjpv9VcD1qOfKYrO1j3P yIs7rKsjodVMn8lgZXaItyGoExtuRIW/modsrSume66RqagZkLEDo3iL0QEjMXAT bYheWhqP8119/9WuF+eaqtLchjlN1Et2+wbPn1c+9aafiGSfKX94qkY21Uk78nfZ 4uoqC9nBWuKGrO+T6zTUurLedpPLoo0E9530LEhIl5vjq3DMZ8RZa6+1xgZXXmyv Lh8eCPd7mokrhO7dBr7yDJsn74oQInqd6y3dXT3/L+dILhO8KbHu50mTME23RNaj 2yZhDcUGAosinGqCCYotPrSLnOwUg== Received: by frisell.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id ebd79066 (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256:NO); Thu, 12 Dec 2019 16:37:36 +0000 (UTC) From: "Jason A. Donenfeld" To: linux-crypto@vger.kernel.org Cc: "Jason A. Donenfeld" , Eric Biggers , Ard Biesheuvel Subject: [PATCH crypto-next v3 0/3] crypto: poly1305 improvements Date: Thu, 12 Dec 2019 18:32:55 +0100 Message-Id: <20191212173258.13358-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 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 modest 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/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 | 10 +- crypto/nhpoly1305.c | 6 +- crypto/poly1305_generic.c | 23 + include/crypto/internal/poly1305.h | 39 +- include/crypto/nhpoly1305.h | 2 +- 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 | 160 +- 19 files changed, 4910 insertions(+), 1362 deletions(-) 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