From patchwork Tue Oct 11 18:15:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 77514 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp121490qge; Tue, 11 Oct 2016 11:16:14 -0700 (PDT) X-Received: by 10.36.82.4 with SMTP id d4mr19391429itb.48.1476209774934; Tue, 11 Oct 2016 11:16:14 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 4si5147972pfk.12.2016.10.11.11.16.14; Tue, 11 Oct 2016 11:16:14 -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 S1753223AbcJKSQM (ORCPT + 1 other); Tue, 11 Oct 2016 14:16:12 -0400 Received: from mail-wm0-f45.google.com ([74.125.82.45]:37171 "EHLO mail-wm0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752729AbcJKSQJ (ORCPT ); Tue, 11 Oct 2016 14:16:09 -0400 Received: by mail-wm0-f45.google.com with SMTP id b201so857572wmb.0 for ; Tue, 11 Oct 2016 11:15:38 -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=GyHMaCIRsP2Kes0GziiUVoYfWelyw08uqh2xh8xExbNzcbfh6S9HMSHSzwuMCY/Ozu 4Qt910WIlLy/GiN+xL8drnYzsSFSD0vPh0ccBBZ4gUPzCKoBBB1L4R6cbO+9cKNExC/p EqP6E+Vb2ND/Ykn/+2TZZYBgdPgi3oZCdqeKY= 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=NCka52jCPn5xA6YBaB2trbw0EoFiaEi9/4gLHzfDIWzT3DTtY1w+heCuDWcwO4SiyU TOYWiJsRAxRJ0oRQ0ygKRB51GpnAf8S0MpeubmBU/VJQu27uKnnkpiKdNlVVa+3jUnIa 7t77RGLNxUMRIyIgjzzSHfmFaJGWnm4pD6mXfcqP98TNpgCpuYbEGYmRYAniw0eK5Gy6 5NegKspMY0oDqINxZzeLfSc6l6LwBtpF6MMx4QeW9i9d8Q5fkWphjj/6c/kF8RTzxh1a +YQGU/H0wmWgcO5MY40z9MBs5CT0V7Hqfy1J0Z1w/zC03zPKTaqQqaMNBazBzCcV/ZVu ARvw== X-Gm-Message-State: AA6/9Rl055gVT1MQAUXmxJxqqtSM2bcFafem+r4XbzhVGr+1vl0IpMNURkJZXXzgK4PAGPi4 X-Received: by 10.28.215.134 with SMTP id o128mr56045wmg.128.1476209737577; Tue, 11 Oct 2016 11:15:37 -0700 (PDT) Received: from localhost.localdomain ([105.147.31.57]) by smtp.gmail.com with ESMTPSA id ya1sm8341523wjb.23.2016.10.11.11.15.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 11 Oct 2016 11:15:36 -0700 (PDT) From: Ard Biesheuvel To: linux-crypto@vger.kernel.org, linux-arm-kernel@lists.infradead.org, herbert@gondor.apana.org.au Cc: will.deacon@arm.com, catalin.marinas@arm.com, linux@arm.linux.org.uk, Ard Biesheuvel Subject: [PATCH v2 3/8] crypto: arm64/sha1-ce - fix for big endian Date: Tue, 11 Oct 2016 19:15:15 +0100 Message-Id: <1476209720-21114-4-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1476209720-21114-1-git-send-email-ard.biesheuvel@linaro.org> References: <1476209720-21114-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)