Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1617757pxu; Thu, 17 Dec 2020 14:29:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJyz52CCA1ehbdpcfTcW94v4ZGUu8SxYjCtZ6QOAh9F9Uav2vfmasi+uzt4GSyDN5Z0lN55Q X-Received: by 2002:a17:906:d8a3:: with SMTP id qc3mr1164512ejb.443.1608244148141; Thu, 17 Dec 2020 14:29:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608244148; cv=none; d=google.com; s=arc-20160816; b=Py2ncXHaqBXMmDaJiwSWPj+NRgUBLnynDKxf0bnquzlLqit+Jz4Q8xnH15PLoDn3U7 uL61auuP4EXBnWbbYp+WRgTQKmvBouRAxa5rvrHjk1AAANUyL2DxKj0HtxfIjng0OPRr Ad8l37C5lZ6Q6hKfVZcQTqyqO4vp0PgcN6hu+TIlCj+9UnpFgiVid81FD4KJm7dGH86U sh80iSY/5uOREuA/HGjJ7DqKXSmE3A9ECZoqmdn3n5nt2B/tepiXTp0fcrWITp25W9Gt 6uWPD1hFT+475zollq8sOH4lMPAY3rXnQBTonkppRP4A/OCS2aWIdeRkPZR1Q15LPm0f n31w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=Glp22nahqkG1uCvuzA0Aaht2iHjSYVoOBgihYh3eNQ0=; b=FIDA/EXMMSNlZgnJ61VODr3nBsO7H/nsbOwm3nbglRQpkT1CfYZEjOl+o3XhjubShv nGdghhgtRsskdg9PPnc90Ty3y4jwlPOdiQQFiSOrex+UnZiYGywkaPyNXvQLOxPZueYJ pip5ICXYF37J0FZb5hn5iiIt2X/roawneqkTt/BBKw2yOvXGErMKAhzzwKiL7MbFnzDM r4M9bd5oGfYjK2l08LI99ojVKgTk7dY1wq6jfwQEgX2gBZPa+TGuaV3NERnj78S5Iwoe QNHumAw5ZY3VJJVkrbj2air2JwVs1jrv+E0xcdPWSyCeUwWNZVE4V3XRRToMDWIGlHPH OL6g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id j10si5017047edt.142.2020.12.17.14.28.48; Thu, 17 Dec 2020 14:29:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 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 S1732068AbgLQWZk (ORCPT + 99 others); Thu, 17 Dec 2020 17:25:40 -0500 Received: from mail.kernel.org ([198.145.29.99]:45150 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727137AbgLQWZk (ORCPT ); Thu, 17 Dec 2020 17:25:40 -0500 From: Eric Biggers Authentication-Results: mail.kernel.org; dkim=permerror (bad message/signature format) To: linux-crypto@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, Ard Biesheuvel , Herbert Xu , David Sterba , "Jason A . Donenfeld" , Paul Crowley Subject: [PATCH v2 00/11] crypto: arm32-optimized BLAKE2b and BLAKE2s Date: Thu, 17 Dec 2020 14:21:27 -0800 Message-Id: <20201217222138.170526-1-ebiggers@kernel.org> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org This patchset adds 32-bit ARM assembly language implementations of BLAKE2b and BLAKE2s. The BLAKE2b implementation is NEON-accelerated, while the BLAKE2s implementation uses scalar instructions since NEON doesn't work very well for it. The BLAKE2b implementation is faster and is expected to be useful as a replacement for SHA-1 in dm-verity, while the BLAKE2s implementation would be useful for WireGuard which uses BLAKE2s. Both implementations are provided via the shash API, while BLAKE2s is also provided via the library API. While adding these, I also reworked the generic implementations of BLAKE2b and BLAKE2s to provide helper functions that make implementing other "shash" providers for these algorithms much easier. See the individual commits for full details, including benchmarks. This patchset was tested on a Raspberry Pi 2 (which uses a Cortex-A7 processor) with CONFIG_CRYPTO_MANAGER_EXTRA_TESTS=y, plus other tests. This patchset applies to mainline commit 0c6c887835b5. Changed since v1: - Added BLAKE2s implementation. - Adjusted the BLAKE2b helper functions to be consistent with what I decided to do for BLAKE2s. - Fixed build error in blake2b-neon-core.S in some configurations. Eric Biggers (11): crypto: blake2b - rename constants for consistency with blake2s crypto: blake2b - define shash_alg structs using macros crypto: blake2b - export helpers for optimized implementations crypto: blake2b - update file comment crypto: arm/blake2b - add NEON-accelerated BLAKE2b crypto: blake2s - define shash_alg structs using macros crypto: x86/blake2s - define shash_alg structs using macros crypto: blake2s - remove unneeded includes crypto: blake2s - share the "shash" API boilerplate code crypto: arm/blake2s - add ARM scalar optimized BLAKE2s wireguard: Kconfig: select CRYPTO_BLAKE2S_ARM arch/arm/crypto/Kconfig | 20 ++ arch/arm/crypto/Makefile | 4 + arch/arm/crypto/blake2b-neon-core.S | 345 ++++++++++++++++++++++++++++ arch/arm/crypto/blake2b-neon-glue.c | 105 +++++++++ arch/arm/crypto/blake2s-core.S | 272 ++++++++++++++++++++++ arch/arm/crypto/blake2s-glue.c | 78 +++++++ arch/x86/crypto/blake2s-glue.c | 150 +++--------- crypto/Kconfig | 5 + crypto/Makefile | 1 + crypto/blake2b_generic.c | 200 +++++++--------- crypto/blake2s_generic.c | 161 +++---------- crypto/blake2s_helpers.c | 87 +++++++ drivers/net/Kconfig | 1 + include/crypto/blake2b.h | 27 +++ include/crypto/internal/blake2b.h | 33 +++ include/crypto/internal/blake2s.h | 17 ++ 16 files changed, 1139 insertions(+), 367 deletions(-) create mode 100644 arch/arm/crypto/blake2b-neon-core.S create mode 100644 arch/arm/crypto/blake2b-neon-glue.c create mode 100644 arch/arm/crypto/blake2s-core.S create mode 100644 arch/arm/crypto/blake2s-glue.c create mode 100644 crypto/blake2s_helpers.c create mode 100644 include/crypto/blake2b.h create mode 100644 include/crypto/internal/blake2b.h base-commit: 0c6c887835b59c10602add88057c9c06f265effe -- 2.29.2