From patchwork Wed Jan 10 12:11:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 124075 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp5199168qgn; Wed, 10 Jan 2018 04:14:09 -0800 (PST) X-Google-Smtp-Source: ACJfBosezVRKOABAgc3vgAcuFRgInBty6dZNEdV/FIhLDhA6S/vBjpp8pTSMXEdr8GNrFRKBDt3B X-Received: by 10.99.61.143 with SMTP id k137mr15543784pga.315.1515586449690; Wed, 10 Jan 2018 04:14:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515586449; cv=none; d=google.com; s=arc-20160816; b=WLORwe9Sbqb+pMriKJuSZQL617zqFbUjr+uULG2ctUWYWdjlROmSLht29FpALdAjmB 1ZIKdhRbDkK3SYSr8kI8PzfSGOvpbUxz7Nj1pEGdHF63w6k6jtO22XFkz3WTwcBUKXmE hOB9jlyoYpyeP85R/zxmWfE9Dfc/dEH09zYGimd/9AxAZweKS/oPN1MTZlTRq83QRAMM lVv+vpimx34xx5f+m/ZNtGkjzKtoZ1nq0fw2HD+jfVVc5oS1dxLGF8nRLudMtiMxfCY9 Vwi40mxPqNcORDDdRrux0HUK/4b3ceoABytzSLOOhY9lrYttl4958fJRj7FhsxvIX1Nu oF3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=UzDHmVA88kHIPG5d2XbNNkTfVigQpoljbpXIvfJnwoo=; b=EFXTuPyEpqMXUVJZ3FgXwAvYkCRkPkoBUsiypc2JCtt1QNQCe2F407u+YT24dxrnEp iVxS/mxsd+PfZ7pCghroBRR7Zvo9UdcRV3YGByvMNlMqbfccIz6COYQUAMlMso6rCRfh UzK9tXI3QVekelmz2GcCk96l0pkNHgY/UG59zpsBu3ru4qSdAbA6l862ncaNRK11Hl70 CYhuK/gEROgeMdk3nqhTHlg5sUDxICB9FIcSGqHkbOMOrsEy1uIY4CqhaLC49CfRH97K FKPoZOrzk3ewem3ZI5mFWEzpHgzwrSbiBLXm/PfGUPvs7PsC6L1BVfVFmdBZwNVDGtgj Rd0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=g9x6ZuM2; 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 y1si6107564pln.324.2018.01.10.04.14.09; Wed, 10 Jan 2018 04:14:09 -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=g9x6ZuM2; 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 S1751884AbeAJMOI (ORCPT + 1 other); Wed, 10 Jan 2018 07:14:08 -0500 Received: from mail-wm0-f68.google.com ([74.125.82.68]:45848 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964968AbeAJMNq (ORCPT ); Wed, 10 Jan 2018 07:13:46 -0500 Received: by mail-wm0-f68.google.com with SMTP id i186so10102158wmi.4 for ; Wed, 10 Jan 2018 04:13:45 -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; bh=UzDHmVA88kHIPG5d2XbNNkTfVigQpoljbpXIvfJnwoo=; b=g9x6ZuM2MIzoYxHOHcfBJWAMxtLGHXptEzORYztgUYgmLEgUIYMCCeQny7OQA+dUAr zC8CSgMA2tzMuEDvWdGVpgDpn/PkwMaZTJOtEL3pB/iQBWUBYK/holKvL/CtyQkyVMVi JoB5pYGsL9ZltUzDUaIEbGoEGmr226s0xiEQQ= 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; bh=UzDHmVA88kHIPG5d2XbNNkTfVigQpoljbpXIvfJnwoo=; b=NRk26cQsDNMJeZYv8fxSTClEXF79OW8KybnQPBk4je03xUIWEY7Ck/doB+A9NGf+Kf 7/pzORqWAmO/2qeP9/GbgDdSoDystHpadWOLQIOlLh81qh3byb2ZF6gtwHg62SN0wZ6a KnR1TtVg3jwi4U6PjLj3g6dwg1qGYcMfv/cJsM1UkpMvSTeEQcDilaz/Z12daMYDpc4t UcQN5daN5gabWu5QNcCyGCNikWm2BPzQCB/G9lj5RxfL2BSxLwklLl/PuvYfYwBXGLai 9JsCIViybcRpeo48BpK4seIMarKFLqYcySs05c3JdQMxqwLzTgybB2LXvTB4APdt+1u5 cF8A== X-Gm-Message-State: AKGB3mJjFlZ1tKQq7k9oBmHlZVbVkXJhZhU76JN315ULNxH9SLgyyU+c AzORdGgIiBRG/2kHWbIK8aoHUA== X-Received: by 10.28.12.2 with SMTP id 2mr14854862wmm.43.1515586425133; Wed, 10 Jan 2018 04:13:45 -0800 (PST) Received: from localhost.localdomain ([154.144.231.40]) by smtp.gmail.com with ESMTPSA id l72sm1261615wmi.4.2018.01.10.04.13.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Jan 2018 04:13:44 -0800 (PST) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org, linux-crypto@vger.kernel.org Cc: herbert@gondor.apana.org.au, will.deacon@arm.com, catalin.marinas@arm.com, marc.zyngier@arm.com, mark.rutland@arm.com, dann.frazier@canonical.com, steve.capper@linaro.org, Ard Biesheuvel Subject: [PATCH 6/7] arm64/crypto: sha2-ce: move the round constant table to .rodata section Date: Wed, 10 Jan 2018 12:11:41 +0000 Message-Id: <20180110121142.18291-7-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180110121142.18291-1-ard.biesheuvel@linaro.org> References: <20180110121142.18291-1-ard.biesheuvel@linaro.org> Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Move the SHA2 round constant table to the .rodata section where it is safe from being exploited by speculative execution. Signed-off-by: Ard Biesheuvel --- arch/arm64/crypto/sha2-ce-core.S | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- 2.11.0 diff --git a/arch/arm64/crypto/sha2-ce-core.S b/arch/arm64/crypto/sha2-ce-core.S index 679c6c002f4f..4c3c89b812ce 100644 --- a/arch/arm64/crypto/sha2-ce-core.S +++ b/arch/arm64/crypto/sha2-ce-core.S @@ -53,6 +53,7 @@ /* * The SHA-256 round constants */ + .section ".rodata", "a" .align 4 .Lsha2_rcon: .word 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5 @@ -76,9 +77,10 @@ * void sha2_ce_transform(struct sha256_ce_state *sst, u8 const *src, * int blocks) */ + .text ENTRY(sha2_ce_transform) /* load round constants */ - adr x8, .Lsha2_rcon + adr_l x8, .Lsha2_rcon ld1 { v0.4s- v3.4s}, [x8], #64 ld1 { v4.4s- v7.4s}, [x8], #64 ld1 { v8.4s-v11.4s}, [x8], #64