From patchwork Sun Jan 27 09:16:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 156686 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp2218823jaa; Sun, 27 Jan 2019 01:17:18 -0800 (PST) X-Google-Smtp-Source: ALg8bN5exqronMDU4k77Pm3RAfjbgm7N4w5lxWt/vUvbfy30XG4VOqN1v1NwS5TzW9v3Bnrb2TtY X-Received: by 2002:a17:902:2887:: with SMTP id f7mr17279595plb.176.1548580638461; Sun, 27 Jan 2019 01:17:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548580638; cv=none; d=google.com; s=arc-20160816; b=sX0D2hC7rBaPr+HD69Raw+kpn4b4LbrG0Q+0MBiC27ssXXaWdCR8Mwx3whe4fYaycq UZvcOmJG1lsEiIxdJDItiKEfWsQ5aNMJAZcCj2n8BB3qeZcckVXAxMNOrCqAPjbjifsd 3TtARkaqAsF65et1Ob6bfjpw7eVyp0bRew447Fo6Vpm19sxHVq0Z1zv3qQ6qMhzulohK H0Z/HqV8M6peKTdFVDQU7UFhsCHtSlxmKIk+U/UQ/EolPkbK1Ls2oJD9Up+wx78aBFsc Qou8AAS2yMbFwOlpW/oPQAekEv0LQobuvUMR+rBz4TwYfvlJUbtQQxR7Y9M1vKrZM8Gc N8qQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=E1b+RzfgoGRiRm1hKJ0ZbQ3LFQyMbA6410V+FseCjyQ=; b=VxREc7g7hfH2+Zn7mjzQPz+AyFlw7phWAGqsSghFfTzmD8TkbcKJIPZ4gr0Gwh5n32 C3FZi53YqQ8usifJJZuN/4KZQZG/JK/zffiqXonI4TjdqD8V/4L1omTJ8V5x++6X4sXs oGvybUUCGsWqSTALoTOQJ7vSsFXdNfIsO7pNiQ3kIHKWR/H7+TZ1IEvMCi7bh/ZJ0oqZ a6x2mUMArcYPKxkT2x47USQsLX7ZO0ZmdqW6L21iko5JqkhuehOHhUKAKvyDYkpKbQPU E63ox86Ni1kNSLSXKg8//cFuZbCHNSiT7qXXeGyafpHHzoARop+iBNre44m7D1xKmQnO UTDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="iJ9ozE/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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q24si5992230pgi.334.2019.01.27.01.17.18; Sun, 27 Jan 2019 01:17:18 -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=@linaro.org header.s=google header.b="iJ9ozE/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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726453AbfA0JRQ (ORCPT + 3 others); Sun, 27 Jan 2019 04:17:16 -0500 Received: from mail-wm1-f67.google.com ([209.85.128.67]:55647 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726327AbfA0JRQ (ORCPT ); Sun, 27 Jan 2019 04:17:16 -0500 Received: by mail-wm1-f67.google.com with SMTP id y139so10644314wmc.5 for ; Sun, 27 Jan 2019 01:17:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=E1b+RzfgoGRiRm1hKJ0ZbQ3LFQyMbA6410V+FseCjyQ=; b=iJ9ozE/N27xwQOzWq7nlQW2d0IrPfNr2Gs8VqAGzKTnDMW59Pw5NN+60LgbeqyP5vj KfVrLrHOxuwuzk8A0utvgEHbyPUyp94Ck5akrJDiJZcG2SihZZuXhHUjTi2+3twaTVLh CBVm1GMjf0MnXWxxsAQbKdttlPf3SX0w/jMWI= 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:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=E1b+RzfgoGRiRm1hKJ0ZbQ3LFQyMbA6410V+FseCjyQ=; b=Ye99qyq4Pqg19XOS7OQW+AhGD4TU9necwm1Pb7lyUrlh5BxIzsWuyvtvSN76BPv5+Z j/p5/2OopEULc2LC/iNG4mQmqRcHzKC7HtRnpKlRdyItMRyGncLQzH/+Qv/E3tKzaoH3 KN6og4XJlYdmpP2iWA/MsqoLikcGI8n1tqdQaVXNJzLGP5KlsPK7d0+/BmiilkUf0NCy E51h7g75qDRpqcUTzannZ/ZOm1Ut37SvFgxP0bvk9K8tvZd+fkSzqgt2T+BcXRRjxWYF XabTnM24MqHxhdXwe9TfGwrF0ZBXlmXSLF8A+RFNX6frCy9oe4En1IcSbAcClPHbyCRM ZNhA== X-Gm-Message-State: AJcUukc5ieS6COhnXdgNiik5Wy70gYCuVU8kknrgqYaFdhPqe/Mx8+eE C+/VjCK5dUfuaGfFCScxQx5MDbfcBfcNPQ== X-Received: by 2002:a1c:7d06:: with SMTP id y6mr12720895wmc.7.1548580634492; Sun, 27 Jan 2019 01:17:14 -0800 (PST) Received: from sudo.home ([2a01:cb1d:112:6f00:887d:32e9:9391:d3bf]) by smtp.gmail.com with ESMTPSA id o5sm45397013wrw.46.2019.01.27.01.17.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 27 Jan 2019 01:17:13 -0800 (PST) From: Ard Biesheuvel To: linux-crypto@vger.kernel.org Cc: herbert@gondor.apana.org.au, ebiggers@kernel.org, Ard Biesheuvel Subject: [PATCH v3 1/4] crypto: arm/crct10dif - revert to C code for short inputs Date: Sun, 27 Jan 2019 10:16:52 +0100 Message-Id: <20190127091655.6262-2-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190127091655.6262-1-ard.biesheuvel@linaro.org> References: <20190127091655.6262-1-ard.biesheuvel@linaro.org> MIME-Version: 1.0 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org The SIMD routine ported from x86 used to have a special code path for inputs < 16 bytes, which got lost somewhere along the way. Instead, the current glue code aligns the input pointer to permit the NEON routine to use special versions of the vld1 instructions that assume 16 byte alignment, but this could result in inputs of less than 16 bytes to be passed in. This not only fails the new extended tests that Eric has implemented, it also results in the code reading past the end of the input, which could potentially result in crashes when dealing with less than 16 bytes of input at the end of a page which is followed by an unmapped page. So update the glue code to only invoke the NEON routine if the input is at least 16 bytes. Reported-by: Eric Biggers Reviewed-by: Eric Biggers Fixes: 1d481f1cd892 ("crypto: arm/crct10dif - port x86 SSE implementation to ARM") Cc: # v4.10+ Signed-off-by: Ard Biesheuvel --- arch/arm/crypto/crct10dif-ce-core.S | 14 ++++++------ arch/arm/crypto/crct10dif-ce-glue.c | 23 +++++--------------- 2 files changed, 13 insertions(+), 24 deletions(-) -- 2.20.1 diff --git a/arch/arm/crypto/crct10dif-ce-core.S b/arch/arm/crypto/crct10dif-ce-core.S index ce45ba0c0687..16019b5961e7 100644 --- a/arch/arm/crypto/crct10dif-ce-core.S +++ b/arch/arm/crypto/crct10dif-ce-core.S @@ -124,10 +124,10 @@ ENTRY(crc_t10dif_pmull) vext.8 q10, qzr, q0, #4 // receive the initial 64B data, xor the initial crc value - vld1.64 {q0-q1}, [arg2, :128]! - vld1.64 {q2-q3}, [arg2, :128]! - vld1.64 {q4-q5}, [arg2, :128]! - vld1.64 {q6-q7}, [arg2, :128]! + vld1.64 {q0-q1}, [arg2]! + vld1.64 {q2-q3}, [arg2]! + vld1.64 {q4-q5}, [arg2]! + vld1.64 {q6-q7}, [arg2]! CPU_LE( vrev64.8 q0, q0 ) CPU_LE( vrev64.8 q1, q1 ) CPU_LE( vrev64.8 q2, q2 ) @@ -167,7 +167,7 @@ CPU_LE( vrev64.8 q7, q7 ) _fold_64_B_loop: .macro fold64, reg1, reg2 - vld1.64 {q11-q12}, [arg2, :128]! + vld1.64 {q11-q12}, [arg2]! vmull.p64 q8, \reg1\()h, d21 vmull.p64 \reg1, \reg1\()l, d20 @@ -238,7 +238,7 @@ _16B_reduction_loop: vmull.p64 q7, d15, d21 veor.8 q7, q7, q8 - vld1.64 {q0}, [arg2, :128]! + vld1.64 {q0}, [arg2]! CPU_LE( vrev64.8 q0, q0 ) vswp d0, d1 veor.8 q7, q7, q0 @@ -335,7 +335,7 @@ _less_than_128: vmov.i8 q0, #0 vmov s3, arg1_low32 // get the initial crc value - vld1.64 {q7}, [arg2, :128]! + vld1.64 {q7}, [arg2]! CPU_LE( vrev64.8 q7, q7 ) vswp d14, d15 veor.8 q7, q7, q0 diff --git a/arch/arm/crypto/crct10dif-ce-glue.c b/arch/arm/crypto/crct10dif-ce-glue.c index d428355cf38d..14c19c70a841 100644 --- a/arch/arm/crypto/crct10dif-ce-glue.c +++ b/arch/arm/crypto/crct10dif-ce-glue.c @@ -35,26 +35,15 @@ static int crct10dif_update(struct shash_desc *desc, const u8 *data, unsigned int length) { u16 *crc = shash_desc_ctx(desc); - unsigned int l; - if (!may_use_simd()) { - *crc = crc_t10dif_generic(*crc, data, length); + if (length >= CRC_T10DIF_PMULL_CHUNK_SIZE && may_use_simd()) { + kernel_neon_begin(); + *crc = crc_t10dif_pmull(*crc, data, length); + kernel_neon_end(); } else { - if (unlikely((u32)data % CRC_T10DIF_PMULL_CHUNK_SIZE)) { - l = min_t(u32, length, CRC_T10DIF_PMULL_CHUNK_SIZE - - ((u32)data % CRC_T10DIF_PMULL_CHUNK_SIZE)); - - *crc = crc_t10dif_generic(*crc, data, l); - - length -= l; - data += l; - } - if (length > 0) { - kernel_neon_begin(); - *crc = crc_t10dif_pmull(*crc, data, length); - kernel_neon_end(); - } + *crc = crc_t10dif_generic(*crc, data, length); } + return 0; } From patchwork Sun Jan 27 09:16:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 156687 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp2218837jaa; Sun, 27 Jan 2019 01:17:20 -0800 (PST) X-Google-Smtp-Source: ALg8bN4vmqxjrdu1QdvC1cNglK4PdkNHdqBBGqZczo6NnO7kbMoSBPkCZCvdrfogLessj3h95jHo X-Received: by 2002:a62:18ce:: with SMTP id 197mr18270384pfy.88.1548580640260; Sun, 27 Jan 2019 01:17:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548580640; cv=none; d=google.com; s=arc-20160816; b=SPFydQpafn73bV2aTmAC4Moe07G/PG6JVzmAqw5xpGyPe0xKNGvVGWsXB804LmEoGn cYuOTIGmAzaetiUUSVDKPLUw12FkGziHwBpkoIviU0XO8Z1dtTOEvwStxX1uGytWdhkn 18/0S7sqcLyTu6zgewhom/cJKXkXv4nkCJ5Nx3gj+AYHoyYmU7bGBQWuX3h79+59jhme 3we1yErG5RAKyBwFaL7g1PVtwtdot4xtQdt1k8uTiyXeB3uevOo4u8I8B2fGnn20Yjlj 95ssxi94fsxBX/F4wpfQtApx+3OTAimT+UBWpC9SaKqw0bf/0w9B3in31elI3uwCHBBg H1FQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=efcg/0yUjs1pm8V27XtFMWmj9BDdcImS71CJ7F3LlQw=; b=kt1iYWFKx7zjdCkdairPE5moMYxbAmnnL7b5L75dTwD0XwnMfHEVx0dAADzxDs0MXs 0vs98XOvzqFpjsdQIazft8zrVequ77Ux16zL0GQstXuL9UF3EMINDkTh7407mtaKTUxw lCP93DSxRf/z1BxTagj2JbbZg05JMrgM9EzTkVIInKdhrNpAVf0aUeBFKu28kovQvrSp Y6Xe7biJECFmXdwSo1IS2SSy1vRMoyBoEpy9zbqZICbxxcjbE+NauCY1wjBwS89ffOih HCc6KfT6M0CZ88xCYoK8k4DWRSe1ds2me6UiFhnigELSFi0+284uXQ5WBXEdlP1UeC2P 3ZUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jZTaJGSE; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q19si1274538pfh.138.2019.01.27.01.17.20; Sun, 27 Jan 2019 01:17:20 -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=@linaro.org header.s=google header.b=jZTaJGSE; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726505AbfA0JRS (ORCPT + 3 others); Sun, 27 Jan 2019 04:17:18 -0500 Received: from mail-wm1-f67.google.com ([209.85.128.67]:35339 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726419AbfA0JRS (ORCPT ); Sun, 27 Jan 2019 04:17:18 -0500 Received: by mail-wm1-f67.google.com with SMTP id t200so10674535wmt.0 for ; Sun, 27 Jan 2019 01:17:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=efcg/0yUjs1pm8V27XtFMWmj9BDdcImS71CJ7F3LlQw=; b=jZTaJGSE32DaGdlVksqdLs+l9lWzTKelFKhE47NUJFPoXkjdPsPo6DGUE64TIEZetr XSFKNQAAmfwO5s1KxoE4qd18G9DYFi7JmR8y1XPMlw/CHKYme1cw66THlcn5u8UvNAwo /N0KCT2VGR/ZpjlUQ4nz5G1Ca0mFsh2vjSGS8= 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:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=efcg/0yUjs1pm8V27XtFMWmj9BDdcImS71CJ7F3LlQw=; b=IzY1EHWhQiXVXg2mEBpgfBSjPGilcFsOq78Fbloeoh5JcZfXxXGYW4BZzE5Wo4LLyA HftPLwL6G49eyvstel01LOiynx1BXToYULIfltAXh+Up4qp1xI+gt01rqVzwHKHiDbJk FaSaTq6Af6JBVCayY0w1/azbOE+XcBLd+U1TNQwfwqcaDnV3gfK/P65zyJh68YW6l34n JkS4i338oRMUYWVPaT3eJaoNSRFvrdZvyn2LqHo/aGbvsVDQHhM3rYfbLqrNAKqkk6P0 1oEIA2ngv+dmqZxCbxt0MplbOajq1BSa0iXzAN1zNtm5srBM2XAUOCeLN0cw60EIcttn +AXg== X-Gm-Message-State: AJcUukerHsdkvBedD904V4o21qJdYW7kxhIQau9T6t90uOPdCBdQn/kX EwH9GhjEXDHziCe4nxdJ3fP8ME67uktmAg== X-Received: by 2002:a1c:96c5:: with SMTP id y188mr1002476wmd.103.1548580635847; Sun, 27 Jan 2019 01:17:15 -0800 (PST) Received: from sudo.home ([2a01:cb1d:112:6f00:887d:32e9:9391:d3bf]) by smtp.gmail.com with ESMTPSA id o5sm45397013wrw.46.2019.01.27.01.17.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 27 Jan 2019 01:17:14 -0800 (PST) From: Ard Biesheuvel To: linux-crypto@vger.kernel.org Cc: herbert@gondor.apana.org.au, ebiggers@kernel.org, Ard Biesheuvel Subject: [PATCH v3 2/4] crypto: arm64/crct10dif - revert to C code for short inputs Date: Sun, 27 Jan 2019 10:16:53 +0100 Message-Id: <20190127091655.6262-3-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190127091655.6262-1-ard.biesheuvel@linaro.org> References: <20190127091655.6262-1-ard.biesheuvel@linaro.org> MIME-Version: 1.0 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org The SIMD routine ported from x86 used to have a special code path for inputs < 16 bytes, which got lost somewhere along the way. Instead, the current glue code aligns the input pointer to 16 bytes, which is not really necessary on this architecture (although it could be beneficial to performance to expose aligned data to the the NEON routine), but this could result in inputs of less than 16 bytes to be passed in. This not only fails the new extended tests that Eric has implemented, it also results in the code reading past the end of the input, which could potentially result in crashes when dealing with less than 16 bytes of input at the end of a page which is followed by an unmapped page. So update the glue code to only invoke the NEON routine if the input is at least 16 bytes. Reported-by: Eric Biggers Reviewed-by: Eric Biggers Fixes: 6ef5737f3931 ("crypto: arm64/crct10dif - port x86 SSE implementation to arm64") Cc: # v4.10+ Signed-off-by: Ard Biesheuvel --- arch/arm64/crypto/crct10dif-ce-glue.c | 25 +++++--------------- 1 file changed, 6 insertions(+), 19 deletions(-) -- 2.20.1 diff --git a/arch/arm64/crypto/crct10dif-ce-glue.c b/arch/arm64/crypto/crct10dif-ce-glue.c index b461d62023f2..567c24f3d224 100644 --- a/arch/arm64/crypto/crct10dif-ce-glue.c +++ b/arch/arm64/crypto/crct10dif-ce-glue.c @@ -39,26 +39,13 @@ static int crct10dif_update(struct shash_desc *desc, const u8 *data, unsigned int length) { u16 *crc = shash_desc_ctx(desc); - unsigned int l; - if (unlikely((u64)data % CRC_T10DIF_PMULL_CHUNK_SIZE)) { - l = min_t(u32, length, CRC_T10DIF_PMULL_CHUNK_SIZE - - ((u64)data % CRC_T10DIF_PMULL_CHUNK_SIZE)); - - *crc = crc_t10dif_generic(*crc, data, l); - - length -= l; - data += l; - } - - if (length > 0) { - if (may_use_simd()) { - kernel_neon_begin(); - *crc = crc_t10dif_pmull(*crc, data, length); - kernel_neon_end(); - } else { - *crc = crc_t10dif_generic(*crc, data, length); - } + if (length >= CRC_T10DIF_PMULL_CHUNK_SIZE && may_use_simd()) { + kernel_neon_begin(); + *crc = crc_t10dif_pmull(*crc, data, length); + kernel_neon_end(); + } else { + *crc = crc_t10dif_generic(*crc, data, length); } return 0; From patchwork Sun Jan 27 09:16:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 156688 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp2218841jaa; Sun, 27 Jan 2019 01:17:20 -0800 (PST) X-Google-Smtp-Source: ALg8bN4LdCyDZWaP4SKmTuJTw+qa5OxiOqjM/jM572sYxHmufPv/xF2SSYhXEWaL1o//7Cns/kIU X-Received: by 2002:a63:1c61:: with SMTP id c33mr15476977pgm.354.1548580640527; Sun, 27 Jan 2019 01:17:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548580640; cv=none; d=google.com; s=arc-20160816; b=B9FrdCTPrXsiwaQ67Bp1UfQ0SAKSZrmWOTZwcFVXy/V1RMc+DCUGdrSDq4pstrnCcD rgUVruQYQbpOQ44WDNijTvCNx1PnZEQsKqFDXHNXClDt5GvrQOWyPz+JeTLrOS5ldKrZ YO2fpyx3UtsKQ+hTkuWWp172ZsZWpguoasOjOaU4jjWfSnMVxX3LQZGP9cBIFf8nUUY0 wDWtslvybbXY4e2hbCMwYKMnyp8bodatbUtxOts4yLJkr6LcRKb0t53dm8YOK1nK9ZuD sl+ThfW6bBpthDGMBMWcxrfeD7/Ie876fTjRqDfGHzNF+6Fx9L6v+afMFlIvOtwEBjZ3 Aqsw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=UT69eWfMu3CrrEpHcC7N6bP4fh+2YTgZE2AB6r62TDY=; b=KqmPTSWf4taDH2+mXzBCZOFp2caSgojuCu3nQUMbbuCqnRf4rzLPD70uxMTRxnz3qH dhwQLe5dlMLq68r7jrjhHtECrJulh4HTUXnTnlhmX13myjMJQTfJDBPD4Cs0IHR2ka6R KnI+mu0RNVZ4fkrtDgrkn58a/RcfpCqCrD4gPEiWH06Y7pEiNkqRGavrfXkgdOarUp7a xumHzpxEyYx/fgd91GjOM2+9Xknofws8W7ERM8jII2VvXypTwi8z6Qe7s8VAahWPDXvZ YsYWEKER4+sP6nY/JV8QA0kGrd91ItRC0i2v8BIUjdm8l4sIpZSPD8anEYYpE1yl5F7B q7Gg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IeNdexJ3; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q19si1274538pfh.138.2019.01.27.01.17.20; Sun, 27 Jan 2019 01:17:20 -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=@linaro.org header.s=google header.b=IeNdexJ3; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726511AbfA0JRT (ORCPT + 3 others); Sun, 27 Jan 2019 04:17:19 -0500 Received: from mail-wr1-f68.google.com ([209.85.221.68]:36510 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726487AbfA0JRT (ORCPT ); Sun, 27 Jan 2019 04:17:19 -0500 Received: by mail-wr1-f68.google.com with SMTP id u4so14621017wrp.3 for ; Sun, 27 Jan 2019 01:17:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=UT69eWfMu3CrrEpHcC7N6bP4fh+2YTgZE2AB6r62TDY=; b=IeNdexJ3bUTrMk4sXS7K0+u+EMGHsicTnWcivNUNYMsBQyC5yPbx7ngfpvEX2DOMZS 2bDszTF0BfN1i1/BqJsbs3UGJQSZj6BaOSE4ijRtoAg7gAg63BfZv914388GDT0JiBGW KMe8WOutx6M+EPjiD6sQusFPgxEA1D8LHLxxU= 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:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=UT69eWfMu3CrrEpHcC7N6bP4fh+2YTgZE2AB6r62TDY=; b=NE0kvc6DpqXAsstYIIX7cgb9EYaaPzIjw0gmoUPMvQUXlFvS2R+OqbFnVYSuGhi65h a8d4ccx1doL8GdmUjV3h5lkaBKEIVvW/xZJczis36onl6Afc4bLCLSo1Hvl9Oml12P06 /WzoNhbIiTlHWVqbsjbR1G2D9BskZ28gS8FO3/Z7OgaFf9hpYF7/VAEppWqKbnE06ih4 idwsY8yFB7oteHHOjvAT9OAUGSQRmdoZbraEPhqJ8kohS+sUWu9w7w5cn12ye+4YHoAJ fRxnk7CUgMAfq+TxANMS6s4txUMhViiynRmW9y+RA3WeLl4tnsI0veioM4QLixMxRk9b CXUQ== X-Gm-Message-State: AJcUukenrYq0dUq9wvlu7O3PUesg0LCi+di/JdR5XRqad6nm3RMiLS0A dxq4dkg8RXtFRkGsKrRD4YX0eUkEsqFDYA== X-Received: by 2002:a5d:664a:: with SMTP id f10mr17358060wrw.311.1548580637102; Sun, 27 Jan 2019 01:17:17 -0800 (PST) Received: from sudo.home ([2a01:cb1d:112:6f00:887d:32e9:9391:d3bf]) by smtp.gmail.com with ESMTPSA id o5sm45397013wrw.46.2019.01.27.01.17.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 27 Jan 2019 01:17:16 -0800 (PST) From: Ard Biesheuvel To: linux-crypto@vger.kernel.org Cc: herbert@gondor.apana.org.au, ebiggers@kernel.org, Ard Biesheuvel Subject: [PATCH v3 3/4] crypto: arm/crct10dif - remove dead code Date: Sun, 27 Jan 2019 10:16:54 +0100 Message-Id: <20190127091655.6262-4-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190127091655.6262-1-ard.biesheuvel@linaro.org> References: <20190127091655.6262-1-ard.biesheuvel@linaro.org> MIME-Version: 1.0 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Remove some code that is no longer called now that we make sure never to invoke the SIMD routine with less that 16 bytes of input. Reviewed-by: Eric Biggers Signed-off-by: Ard Biesheuvel --- arch/arm/crypto/crct10dif-ce-core.S | 13 ------------- 1 file changed, 13 deletions(-) -- 2.20.1 diff --git a/arch/arm/crypto/crct10dif-ce-core.S b/arch/arm/crypto/crct10dif-ce-core.S index 16019b5961e7..d058fad423c2 100644 --- a/arch/arm/crypto/crct10dif-ce-core.S +++ b/arch/arm/crypto/crct10dif-ce-core.S @@ -342,7 +342,6 @@ CPU_LE( vrev64.8 q7, q7 ) cmp arg3, #16 beq _128_done // exactly 16 left - blt _less_than_16_left // now if there is, load the constants vldr d20, rk1 @@ -353,18 +352,6 @@ CPU_LE( vrev64.8 q7, q7 ) addlt arg3, arg3, #16 blt _get_last_two_regs b _16B_reduction_loop - -_less_than_16_left: - // shl r9, 4 - adr ip, tbl_shf_table + 16 - sub ip, ip, arg3 - vld1.8 {q0}, [ip] - vmov.i8 q9, #0x80 - veor.8 q0, q0, q9 - vtbl.8 d18, {d14-d15}, d0 - vtbl.8 d15, {d14-d15}, d1 - vmov d14, d18 - b _128_done ENDPROC(crc_t10dif_pmull) // precomputed constants From patchwork Sun Jan 27 09:16:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 156689 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp2218856jaa; Sun, 27 Jan 2019 01:17:22 -0800 (PST) X-Google-Smtp-Source: ALg8bN6Ll4Vk+vA8Vy1Y/+ko87k9k9NWEjCGrJYFtBKBr8E88rBgiHBwxWz+wqOlWmEgUamWwQfX X-Received: by 2002:a17:902:6acc:: with SMTP id i12mr17216868plt.148.1548580642188; Sun, 27 Jan 2019 01:17:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548580642; cv=none; d=google.com; s=arc-20160816; b=W1woi5GjASSzBbXDKcbdgfwl06cvBj4xZoibjJ3Zcz3wVOlT3UHfbDZ4beFAF9rWhI nX5Xx5D61ko3Pw+tdVb1wPzZDHa3l7OQjPdfaz5pkC+1gXjFEseEHkcO3T3pi/JSq0uW TJfnWs2s9RUWlknzVWf+bn1h+u/4DJjjb0IJvOLRaJ7ZYUTTO962nLvR6pXKTnIOn4/v poa+ZRvxsklvlmO5McR7JlTqzEJS3BLZ5RCIUyT0YxFTpbMB1MR50l4Qt2vBJfEQWWTl mucBgYqSwNIibuItjHDNhhLjKkQxZq5WovJE0ze46oVmN8c4VMny96ypmYhMCotGNsgb xdSA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=G/cXfni8tC087b78yKP77hOg0xmVLVtxIh5Ne/oqtbI=; b=v3CfrELIiRFrndnLk/MujvDKJlYkgvu8J05HJFRZLP2kuWcDqLzXWyCchCGyVCk9dx 9jCdnH2mLvd6PglwAxZ/kIQCrnupcPXHz2kJOtkgQXUgBr6g0iZgl7ksQf0GGw5YScAU tJnhaB9HJgEL7H674fTgUOiJrrVdhGoAj7J8Rqmwg2MLtCPKMJvERySfXlFCZXFO6BbO 42UNKxgk5NSHpT1QerN54ZK0CSK1rl4ufZNxKvAkbFo6dX2x13PAZzjWSryPmN7y88Wr DRxKD5YTqCHkL8JjiGoiho/CEHawLnckmku8apEv1zDapn7K8lGr1kEsH0LlIZNLVbTm BfoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="CgF/Io8R"; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i33si12248598pld.329.2019.01.27.01.17.21; Sun, 27 Jan 2019 01:17:22 -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=@linaro.org header.s=google header.b="CgF/Io8R"; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726487AbfA0JRV (ORCPT + 3 others); Sun, 27 Jan 2019 04:17:21 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:38540 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726419AbfA0JRU (ORCPT ); Sun, 27 Jan 2019 04:17:20 -0500 Received: by mail-wr1-f65.google.com with SMTP id v13so14592778wrw.5 for ; Sun, 27 Jan 2019 01:17:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=G/cXfni8tC087b78yKP77hOg0xmVLVtxIh5Ne/oqtbI=; b=CgF/Io8Rul3HwRKGuljVs2V0IcBHdz7kEXJPBSfz8qtJDIBrQHsbFJaNlBS2RODl3C Lq4ZL2T9PPQ7H6HGcMwCcTEmBFctsznC8u03Mjr+Ml2tBRH4gLAtZMTaAfSLcE6VG4z2 GbInX3fWlhiwulKzWbMysYKydEuox9VZZVN/w= 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:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=G/cXfni8tC087b78yKP77hOg0xmVLVtxIh5Ne/oqtbI=; b=UyBNyBB2wfgZaZzk21Ghsc6qHGhscyTWoPKJjtOERpC0Eb0TVXigWk2gri4zvmLvb/ lJZrXalgDDEUE5kKs07552txnGWBJqaA066Iw68MtWA6T2+mDf4P0zWpxOiFTZUGXSFJ WLHaRnKpIc8OqjuI7PhxzX9B4a//qbi6cg3eYE7MEOnLQcVKYP342jiUrSinRFTrjHxo onD/RKDszZrMdWg1Lh/6KYqK5kb9sH1Ef2BJtFRcio9vYXBU2Dii4z5CDuMvwhSy7pLk Fu6xqRxyBiczP6/UM6+hDMktf2xIPJ5lOcvHjLanwRmu6cIeAsh4cXvlfvGnSMT/Yddi Z/SQ== X-Gm-Message-State: AJcUukezkLrn1fu8Tmy2GBVhTccabFFGzvm9NLt6CnUxLpv2iJPu1tmh mva3HJG8KgoAQrZeHRahwQsRTnAe1Ud+rQ== X-Received: by 2002:adf:dbcb:: with SMTP id e11mr18293645wrj.58.1548580638478; Sun, 27 Jan 2019 01:17:18 -0800 (PST) Received: from sudo.home ([2a01:cb1d:112:6f00:887d:32e9:9391:d3bf]) by smtp.gmail.com with ESMTPSA id o5sm45397013wrw.46.2019.01.27.01.17.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 27 Jan 2019 01:17:17 -0800 (PST) From: Ard Biesheuvel To: linux-crypto@vger.kernel.org Cc: herbert@gondor.apana.org.au, ebiggers@kernel.org, Ard Biesheuvel Subject: [PATCH v3 4/4] crypto: arm64/crct10dif - remove dead code Date: Sun, 27 Jan 2019 10:16:55 +0100 Message-Id: <20190127091655.6262-5-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190127091655.6262-1-ard.biesheuvel@linaro.org> References: <20190127091655.6262-1-ard.biesheuvel@linaro.org> MIME-Version: 1.0 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Remove some code that is no longer called now that we make sure never to invoke the SIMD routine with less than 16 bytes of input. Reviewed-by: Eric Biggers Signed-off-by: Ard Biesheuvel --- arch/arm64/crypto/crct10dif-ce-core.S | 11 ----------- 1 file changed, 11 deletions(-) -- 2.20.1 diff --git a/arch/arm64/crypto/crct10dif-ce-core.S b/arch/arm64/crypto/crct10dif-ce-core.S index 9e82e8e8ed05..f7326259c40d 100644 --- a/arch/arm64/crypto/crct10dif-ce-core.S +++ b/arch/arm64/crypto/crct10dif-ce-core.S @@ -497,7 +497,6 @@ CPU_LE( ext v7.16b, v7.16b, v7.16b, #8 ) cmp arg3, #16 b.eq .L_128_done_\@ // exactly 16 left - b.lt .L_less_than_16_left_\@ ldr_l q10, rk1, x8 // rk1 and rk2 in xmm10 __pmull_pre_\p v10 @@ -509,16 +508,6 @@ CPU_LE( ext v7.16b, v7.16b, v7.16b, #8 ) add arg3, arg3, #16 b .L_get_last_two_regs_\@ - -.L_less_than_16_left_\@: - // shl r9, 4 - adr_l x0, tbl_shf_table + 16 - sub x0, x0, arg3 - ld1 {v0.16b}, [x0] - movi v9.16b, #0x80 - eor v0.16b, v0.16b, v9.16b - tbl v7.16b, {v7.16b}, v0.16b - b .L_128_done_\@ .endm ENTRY(crc_t10dif_pmull_p8)