From patchwork Wed Jan 10 12:11:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 124076 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp5199307qgn; Wed, 10 Jan 2018 04:14:17 -0800 (PST) X-Google-Smtp-Source: ACJfBosnZI5lIuGnoqfOUDngybUdOXb69ueVzFvmL0EMKdrVVPKoMbyzMDQc4zLlnJD4isP6964H X-Received: by 10.101.90.129 with SMTP id c1mr15057772pgt.209.1515586457532; Wed, 10 Jan 2018 04:14:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515586457; cv=none; d=google.com; s=arc-20160816; b=Gd1LVXq0YIBdNYjl0XSnmB1gM3V37bt+/XV6tNL9B0SG+YUMEFJx3K9TfjTynu8NnC TWHZF37aIqnYOnd2kbCZd/2mmanR3OR6DbXL9A+WumqEiVAZgShzvmH4525H3RC5A5GU rOoxTPFrOdJvkqcd3hMzjRIUixPobSBq+ABf4xtz7kFEt0bTEWKfW1d3oXeETXZs5eYA aw9UqA7S8nVohbRGK/iLRYZXnyTHB1Xjlu7Rwmq5nzqusuhTYM6aLfZbqKstGelfDlan 8TdsKVYtWaVoXnRV0UXPSnZygFEo7EcU0XpdTHyaKMR8svnvguhl6UmASSMqCK57Q3kF ufVg== 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=L6hh2zUbxFH9E4x38JcNUHoFDnHjFEBUuttnSmIZZ98=; b=VcXhDcqDotzGn19u5s+GrrfRDUiDYIYDY7V/0i38Yp13s+/7frFq2rtC87GF72OxHF 841YKQYYbahDKfFGrJMFBVpoT+hKltm2NEQTcF1bAodwYhziAwZHrtkWw5HYPB1Cl8UG RntLTgXpcYcXXAytBTpsonw7zYqyhRoddXqsq9I3NOE8MGD5fVp1SOViNfbWnXDsafBD 3Q6FVJ5+dxaKCLbYXYhzRebdXE8D1o82pJo7yDhNs2WmDPXHtFgzZRYtJtyYHvYuRxfI va6IhJm4CiFRB405sQQ965c6qOF8qHLCaWGuZDszb0sSitdk43pSnDTp79Miul5uwMMT MtsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CZ2Ha6El; 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.17; Wed, 10 Jan 2018 04:14:17 -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=CZ2Ha6El; 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 S964968AbeAJMOO (ORCPT + 1 other); Wed, 10 Jan 2018 07:14:14 -0500 Received: from mail-wm0-f65.google.com ([74.125.82.65]:43015 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754968AbeAJMNj (ORCPT ); Wed, 10 Jan 2018 07:13:39 -0500 Received: by mail-wm0-f65.google.com with SMTP id g1so8591355wmg.2 for ; Wed, 10 Jan 2018 04:13:39 -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=L6hh2zUbxFH9E4x38JcNUHoFDnHjFEBUuttnSmIZZ98=; b=CZ2Ha6El0ubLi2nTeVMFVq3CIvOobsZyRpZsBPy4VeWxNlq1wmvLPQfUez8f9JNdM2 /OutBoUZxPJ30JELWyL8A1c3pplCzdhLN06dOvWYVzh9OnPhNWvkGGIRx6RqhvMLF8z1 wT1fZyF+Ru0oqcljqbRmIR1aJIi+80+R0D4TQ= 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=L6hh2zUbxFH9E4x38JcNUHoFDnHjFEBUuttnSmIZZ98=; b=j4KSC9CQVy5igxlmxg/VAnco4bFHkmUk+7CjySTRuVl/SqQTaYxc37ZCKlTINtoIca MjRoBmqoUXfE145wWsO6bxNAPT/8N49JMqX0ZMoZxM/ia8zTNMjwMrm5UhDlq0Li2SH8 l03sZ24Q0uT3l10jUE+QFJXDySCaFSNRNlvcd1g92TwVo4baNyG++RkY/SQIg2Q9nCst mD5ZvHwtq8vLyu2Tqt06ECbjJYIkLpq4fHzOSNm1SY7CcFKoPYanWx8FozqF9EgI+HB9 P+USbmWTHE1BVgMOdF3E6Hw/AxrECOQfVvdRY3UtdhP1cBixtNp4xKpECvZ3Mz1UBLkm APZg== X-Gm-Message-State: AKGB3mJONsn/rNzKQgBOyHHLwS7EJC4Wx/2PTU71ZNDQGoSEKwWpDLma K87mj8mE2q8lTASdEjLOdH4HvQ== X-Received: by 10.28.234.10 with SMTP id i10mr14474863wmh.49.1515586418385; Wed, 10 Jan 2018 04:13:38 -0800 (PST) Received: from localhost.localdomain ([154.144.231.40]) by smtp.gmail.com with ESMTPSA id l72sm1261615wmi.4.2018.01.10.04.13.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Jan 2018 04:13:37 -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 3/7] arm64/crypto: aes-neon: move literal data to .rodata section Date: Wed, 10 Jan 2018 12:11:38 +0000 Message-Id: <20180110121142.18291-4-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 S-boxes and some other literals to the .rodata section where it is safe from being exploited by speculative execution. Signed-off-by: Ard Biesheuvel --- arch/arm64/crypto/aes-neon.S | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) -- 2.11.0 diff --git a/arch/arm64/crypto/aes-neon.S b/arch/arm64/crypto/aes-neon.S index f1e3aa2732f9..1c7b45b7268e 100644 --- a/arch/arm64/crypto/aes-neon.S +++ b/arch/arm64/crypto/aes-neon.S @@ -32,10 +32,10 @@ /* preload the entire Sbox */ .macro prepare, sbox, shiftrows, temp - adr \temp, \sbox movi v12.16b, #0x1b - ldr q13, \shiftrows - ldr q14, .Lror32by8 + ldr_l q13, \shiftrows, \temp + ldr_l q14, .Lror32by8, \temp + adr_l \temp, \sbox ld1 {v16.16b-v19.16b}, [\temp], #64 ld1 {v20.16b-v23.16b}, [\temp], #64 ld1 {v24.16b-v27.16b}, [\temp], #64 @@ -272,7 +272,7 @@ #include "aes-modes.S" - .text + .section ".rodata", "a" .align 6 .LForward_Sbox: .byte 0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5