From patchwork Sun Oct 9 17:42:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 77410 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp928148qge; Sun, 9 Oct 2016 10:42:43 -0700 (PDT) X-Received: by 10.98.106.65 with SMTP id f62mr38377133pfc.107.1476034963267; Sun, 09 Oct 2016 10:42:43 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r5si16333080pap.347.2016.10.09.10.42.43; Sun, 09 Oct 2016 10:42:43 -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=neutral (body hash did not verify) header.i=@linaro.org; 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=fail (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751947AbcJIRmm (ORCPT + 1 other); Sun, 9 Oct 2016 13:42:42 -0400 Received: from mail-lf0-f42.google.com ([209.85.215.42]:33003 "EHLO mail-lf0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751352AbcJIRml (ORCPT ); Sun, 9 Oct 2016 13:42:41 -0400 Received: by mail-lf0-f42.google.com with SMTP id x79so84675626lff.0 for ; Sun, 09 Oct 2016 10:42:41 -0700 (PDT) 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; bh=vYkR2xF+3ELEx7HyLNSf3khyTnUtTff7/jDxTgPxH1I=; b=dCwta6MvY2wACo6k9lTSL/p59iXi2AZEg5HiNMyGMMGX0JV1xfC1hrorZtfSdZikgr t1/vuGfbnM6yonZAyLAfKhUL1O3BHJm6c9RjsCdNDAnFR/iMpXZutn5DUXsSuhokfEF9 RLoX+H8UIDm/FTLD6jR0TYwzuXmRsfL7hWF9Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=vYkR2xF+3ELEx7HyLNSf3khyTnUtTff7/jDxTgPxH1I=; b=A7PhlJOvUGGuvGK1GymQM259A3LCQTsQRqhhxyxhxn4ju/jdfHNgyAX25CO7R+cmqP CcyxV3JrVj7KvMwYKwtJ6wsHeKikpRfIAemNcQRYa05ANzyzrAq0hll/dPZ3mQnEcxYw U6cJtrxvMRjftlDiAaUwIPmRqKZlwX1DeVa5B7XuuKEuZ7gbt6fNJUoxLr+Ji7l7zRyT 7RrFQV7irWbDs9Ri+FstW57tSOKOf1pBbgZ+31TEhyr45PWhQG/JR+ZvcGjchFF0+Kd7 imU+l5syIatr9t+IYoRgRP8IoMA33tg84jZUZ7UGhIvTM/zGOc68qzgUE2hBGZWVFl1V DMsQ== X-Gm-Message-State: AA6/9RlVBX2oe5bFRVKScOjL/KfmUcHbnfrALRJCngD/0pMQJCAdmxFAsbc0OsgoVNMHOz5C X-Received: by 10.194.16.161 with SMTP id h1mr24939989wjd.164.1476034960147; Sun, 09 Oct 2016 10:42:40 -0700 (PDT) Received: from localhost.localdomain ([45.218.219.19]) by smtp.gmail.com with ESMTPSA id uw3sm32503415wjb.21.2016.10.09.10.42.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 09 Oct 2016 10:42:39 -0700 (PDT) From: Ard Biesheuvel To: linux-crypto@vger.kernel.org, linux-arm-kernel@lists.infradead.org, herbert@gondor.apana.org.au Cc: catalin.marinas@arm.com, will.deacon@arm.com, Ard Biesheuvel Subject: [PATCH 3/6] crypto: arm64/sha1-ce - fix for big endian Date: Sun, 9 Oct 2016 18:42:22 +0100 Message-Id: <1476034945-9186-4-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1476034945-9186-1-git-send-email-ard.biesheuvel@linaro.org> References: <1476034945-9186-1-git-send-email-ard.biesheuvel@linaro.org> Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org The SHA1 digest is an array of 5 32-bit quantities, so we should refer to them as such in order for this code to work correctly when built for big endian. So replace 16 byte scalar loads and stores with 4x4 vector ones where appropriate. Fixes: 2c98833a42cd ("arm64/crypto: SHA-1 using ARMv8 Crypto Extensions") Signed-off-by: Ard Biesheuvel --- arch/arm64/crypto/sha1-ce-core.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/arm64/crypto/sha1-ce-core.S b/arch/arm64/crypto/sha1-ce-core.S index 033aae6d732a..c98e7e849f06 100644 --- a/arch/arm64/crypto/sha1-ce-core.S +++ b/arch/arm64/crypto/sha1-ce-core.S @@ -78,7 +78,7 @@ ENTRY(sha1_ce_transform) ld1r {k3.4s}, [x6] /* load state */ - ldr dga, [x0] + ld1 {dgav.4s}, [x0] ldr dgb, [x0, #16] /* load sha1_ce_state::finalize */ @@ -144,7 +144,7 @@ CPU_LE( rev32 v11.16b, v11.16b ) b 1b /* store new state */ -3: str dga, [x0] +3: st1 {dgav.4s}, [x0] str dgb, [x0, #16] ret ENDPROC(sha1_ce_transform)