From patchwork Tue Oct 11 18:15:16 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 77513 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp121482qge; Tue, 11 Oct 2016 11:16:13 -0700 (PDT) X-Received: by 10.107.26.79 with SMTP id a76mr7808033ioa.54.1476209773775; Tue, 11 Oct 2016 11:16:13 -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.13; Tue, 11 Oct 2016 11:16:13 -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 S1752352AbcJKSQL (ORCPT + 1 other); Tue, 11 Oct 2016 14:16:11 -0400 Received: from mail-wm0-f54.google.com ([74.125.82.54]:35828 "EHLO mail-wm0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752820AbcJKSQJ (ORCPT ); Tue, 11 Oct 2016 14:16:09 -0400 Received: by mail-wm0-f54.google.com with SMTP id f193so828484wmg.0 for ; Tue, 11 Oct 2016 11:15:40 -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=IMtIbK5gSsIFzrvHipuqZ+3pYa00xS/pGUZp9eS6XDI=; b=WHKuZ4uAhyFLbn3p8/huBxcmYvmEoUe37TR/Mqj+UZAGPdrEP9+fhh0fZY5vu6saL2 aR9zXxHJ5lKaXh80dFXxz9003FZVw5bjHpKCde95LO5jlkWo78r3A71Ca4LguemQoXaY Xtv1YnecMOH0rAi6gdUgk7l4NFs+SR20XoSH8= 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=IMtIbK5gSsIFzrvHipuqZ+3pYa00xS/pGUZp9eS6XDI=; b=a9c2khxKMu9S9fyL5bjsUJyawGWDVTMGlhLzcmouydyiuixNd4ogsRmNt6/8r1z38m 6vt0CqeXRsVDv1+4u86ZuwMaU5TtJj7UXgCH0qKNzdz5AOMcIuRPqMt9CQ1dW/rjjXia 1B0pIuTzgqSlDdzXvoZ453St3WDzToySDwzzZX3vt7uw4MXtGH/hfU24NoSObL143Jx/ jISVRu5r9songdarc5+03gcAz5TooBBi8xDg2ga41+i7Apj3J7jSYQgaO8x2TUBMWLJn Zb7NXKvalkeqpQdqXKUVHIJa7XR2j12HjR5plC/TjWYRulwtnVfU4+ZiO9L3fSVMdESF Rb/A== X-Gm-Message-State: AA6/9Rlp8mw1y0UVJgWzhiJMeCA9EUb+oyO0MYtx+E7T5yfkdz+r8/Bj9WR+1wNxcN6d/GeT X-Received: by 10.194.57.180 with SMTP id j20mr6532306wjq.203.1476209740153; Tue, 11 Oct 2016 11:15:40 -0700 (PDT) Received: from localhost.localdomain ([105.147.31.57]) by smtp.gmail.com with ESMTPSA id ya1sm8341523wjb.23.2016.10.11.11.15.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 11 Oct 2016 11:15:39 -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 4/8] crypto: arm64/sha2-ce - fix for big endian Date: Tue, 11 Oct 2016 19:15:16 +0100 Message-Id: <1476209720-21114-5-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 SHA256 digest is an array of 8 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 4x32 vector ones where appropriate. Fixes: 6ba6c74dfc6b ("arm64/crypto: SHA-224/SHA-256 using ARMv8 Crypto Extensions") Signed-off-by: Ard Biesheuvel --- arch/arm64/crypto/sha2-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/sha2-ce-core.S b/arch/arm64/crypto/sha2-ce-core.S index 5df9d9d470ad..01cfee066837 100644 --- a/arch/arm64/crypto/sha2-ce-core.S +++ b/arch/arm64/crypto/sha2-ce-core.S @@ -85,7 +85,7 @@ ENTRY(sha2_ce_transform) ld1 {v12.4s-v15.4s}, [x8] /* load state */ - ldp dga, dgb, [x0] + ld1 {dgav.4s, dgbv.4s}, [x0] /* load sha256_ce_state::finalize */ ldr w4, [x0, #:lo12:sha256_ce_offsetof_finalize] @@ -148,6 +148,6 @@ CPU_LE( rev32 v19.16b, v19.16b ) b 1b /* store new state */ -3: stp dga, dgb, [x0] +3: st1 {dgav.4s, dgbv.4s}, [x0] ret ENDPROC(sha2_ce_transform)