From patchwork Tue Nov 29 16:48:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 13058852 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 175B0C4167B for ; Tue, 29 Nov 2022 16:50:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=T+6RfgoAx1HHTHueEZqnk4yNq6gjDdy3t9xeQNWtWB8=; b=hCTWmLQJdFAVKG fp+IbhMhwr1idg5LRApuZSw6mNUVGhxaZD6hsLpt767xRNRSQA+PYRc4WB0TqXn1oPT3X1AoQl87V j1VjzuEQtEQbcLoNJqEu5e8HzQ0Ww4UMKKDdGlaC7jliksjIR0VKzvrKlqMPAY/fveWYoM8yWMJDi O/iZe8Qc4c3yn0yUf0FCICX3BUbMwU0KVQatKN0r4mIEvEV4p/lMMRk35Ouz3UIzzckr6GHCigLSw iR7qSgQ1znokItOMoZpA8miRKK3tBFhN24o1F4GFmyIheUOGShEJ3KuMM43eVAhu9LZ3khor8XVW3 XhzjaErZ+SsnfPkGD+Sg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1p03nM-00AFpj-AO; Tue, 29 Nov 2022 16:49:20 +0000 Received: from ams.source.kernel.org ([2604:1380:4601:e00::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1p03n9-00AFjk-2L for linux-arm-kernel@lists.infradead.org; Tue, 29 Nov 2022 16:49:08 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 6DD70B816D7; Tue, 29 Nov 2022 16:49:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DE550C433D6; Tue, 29 Nov 2022 16:49:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669740544; bh=oQMUkxvrTm4OuRm3HK0ePgwoHaMfWUymrN1oCIlb2jY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FOaN4rh6k1CDY798/SmgJ3l2/m7HPaFp/qv8aBLDD6vr0oQWND7XoyXHiiQc69gf/ s84kJUofyLit14gtkj/xwbOKD8yPEVmiizdzN6FvGNZ9bRrW1ONBqutLsMMhpGZEHE dWnks2Bef8fCUisMmTrp9OTsLEgsQVRthPe0WaIdpWCBMuQAbbw2+OBo3X/7GW/9em /gyuCVc4/EbZPnwOrdhKw/gEJFIx9I1ZjxA+rOJampNW8kWSTQs4eGOqRJXds5V35j TCFmp/GENg1lj6ZZ7AQ7aLFUMkjFMM0kBRRCAJhru8lllyqahCbHNJd8++z3+/M+hP 8BCc8ePvuNZ0Q== From: Ard Biesheuvel To: linux-crypto@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, herbert@gondor.apana.org.au, keescook@chromium.org, ebiggers@kernel.org, Ard Biesheuvel Subject: [PATCH 1/4] crypto: arm64/aes-neonbs - use frame_push/pop consistently Date: Tue, 29 Nov 2022 17:48:49 +0100 Message-Id: <20221129164852.2051561-2-ardb@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221129164852.2051561-1-ardb@kernel.org> References: <20221129164852.2051561-1-ardb@kernel.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1902; i=ardb@kernel.org; h=from:subject; bh=oQMUkxvrTm4OuRm3HK0ePgwoHaMfWUymrN1oCIlb2jY=; b=owEB7QES/pANAwAKAcNPIjmS2Y8kAcsmYgBjhjfuqjkvuSq8aMyx5h/TfQRJuuGKk2UmquyRiuAo IQMNdYOJAbMEAAEKAB0WIQT72WJ8QGnJQhU3VynDTyI5ktmPJAUCY4Y37gAKCRDDTyI5ktmPJCvUC/ 0cb3km+z0Qvj0HffLq7ioFO7uB1DlYHHBcKY0MSdqexVFyd/wnPKH3lP5Xm/6TPob7nz3YhGVM3oGd f1YRC65DV10O6BqjDtU+9X70RCJlA5aDglTMNgsoyGOL2EWUYgzBwap4i/+glRcC2xIHGAa/SGPvjF cDpLlm1QA0fNT7Sn6DcdtIS0shkTqBOjOQ+hIeyFrFZ3XXDP0EYFcAtj+TM6hbt4JXDay+m3MstQ0Q H72d51ysDC6A42vZWQD/ewsslJKXUCSJK60sd0eZesp97adxC9tt2y3rsE62FF4iOzeGU+WZo5tJWx LUabmAs/MWahWrIcLzytk1y+TlaE1NJdszRpM0J8MeHKYXkR+O0RDadHz+vVVG1tpRyRb5ZWJCkVNY h+lwfZssKwuK9Z1x8Mo7dmnqwYtbm3WvXmrCgRSY4ACC+deBa0k03V4llx+CNfBsp7EzYCBGOPV/+s RCUp3jUwvUQxbBfnGPIVoBrxujYF+DD2qo+DcskkBp1DM= X-Developer-Key: i=ardb@kernel.org; a=openpgp; fpr=F43D03328115A198C90016883D200E9CA6329909 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221129_084907_447256_3716BA68 X-CRM114-Status: UNSURE ( 9.87 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use the frame_push and frame_pop macros consistently to create the stack frame, so that we will get PAC and/or shadow call stack handling as well when enabled. Signed-off-by: Ard Biesheuvel --- arch/arm64/crypto/aes-neonbs-core.S | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/arch/arm64/crypto/aes-neonbs-core.S b/arch/arm64/crypto/aes-neonbs-core.S index 66eb3f076fa7a6cf..e4da53b3f189e2bd 100644 --- a/arch/arm64/crypto/aes-neonbs-core.S +++ b/arch/arm64/crypto/aes-neonbs-core.S @@ -772,7 +772,7 @@ SYM_FUNC_START_LOCAL(__xts_crypt8) eor v6.16b, v6.16b, v31.16b eor v7.16b, v7.16b, v16.16b - stp q16, q17, [sp, #16] + stp q16, q17, [x6] mov bskey, x2 mov rounds, x3 @@ -780,8 +780,8 @@ SYM_FUNC_START_LOCAL(__xts_crypt8) SYM_FUNC_END(__xts_crypt8) .macro __xts_crypt, do8, o0, o1, o2, o3, o4, o5, o6, o7 - stp x29, x30, [sp, #-48]! - mov x29, sp + frame_push 0, 32 + add x6, sp, #.Lframe_local_offset ld1 {v25.16b}, [x5] @@ -793,7 +793,7 @@ SYM_FUNC_END(__xts_crypt8) eor v18.16b, \o2\().16b, v27.16b eor v19.16b, \o3\().16b, v28.16b - ldp q24, q25, [sp, #16] + ldp q24, q25, [x6] eor v20.16b, \o4\().16b, v29.16b eor v21.16b, \o5\().16b, v30.16b @@ -807,7 +807,7 @@ SYM_FUNC_END(__xts_crypt8) b.gt 0b st1 {v25.16b}, [x5] - ldp x29, x30, [sp], #48 + frame_pop ret .endm @@ -832,9 +832,7 @@ SYM_FUNC_END(aesbs_xts_decrypt) * int rounds, int blocks, u8 iv[]) */ SYM_FUNC_START(aesbs_ctr_encrypt) - stp x29, x30, [sp, #-16]! - mov x29, sp - + frame_push 0 ldp x7, x8, [x5] ld1 {v0.16b}, [x5] CPU_LE( rev x7, x7 ) @@ -874,6 +872,6 @@ CPU_LE( rev x8, x8 ) b.gt 0b st1 {v0.16b}, [x5] - ldp x29, x30, [sp], #16 + frame_pop ret SYM_FUNC_END(aesbs_ctr_encrypt) From patchwork Tue Nov 29 16:48:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 13058854 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CC987C433FE for ; Tue, 29 Nov 2022 16:50:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=HYUDOuPAPefW7Vw1N8V/ig/1RQT6viENtK9qPvqvvUE=; b=COf8oGQVt9wqq6 WZzDOxAEhhoJrBr13kXj7YhqLr98ca4pKXh4vvAD1qzIB0hWYl8OGDm2PLfaD3Co+KZxOs7pD219w HsdsJh0Eq7M+Yez/VSvNwHkBye0K8pOZ5IwkltxY1Dil0iEguzKOqukDhklMcTfBVdPjAYRZ5B2u4 h/D0wJBCnx8xhnc9LJHdk610HjixWLBvd2ftXgu1VKv/t/zRY6XM9w5WMqsm+oQ8If0ieGkEgHZFd O4nxxsn4cOiLF5eU50YB5Q9oINN2J3KVbIPBUiIRu70QbOXfR6Rp959xXnodRhNXAEzAcfjGYb8/Y IY08gDJ8yYRGGbCsk5hA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1p03nk-00AFvz-3g; Tue, 29 Nov 2022 16:49:44 +0000 Received: from ams.source.kernel.org ([145.40.68.75]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1p03nA-00AFlD-QD for linux-arm-kernel@lists.infradead.org; Tue, 29 Nov 2022 16:49:10 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2FFC1B816E9; Tue, 29 Nov 2022 16:49:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A0019C433C1; Tue, 29 Nov 2022 16:49:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669740546; bh=9SaQlin5wIPSWq6g8wiEQHueYYCgsDKbOKZ0VuZfqu0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=URq6AxQgbJUKmVR/yOoJCXfth/DGQD4tsIfBNcXClyFWyfmyhQWZvXcgl3PnzxG9/ gENXtdi1Dn4Q3ktgr8tSZIZz5MS7SJKqe61nbqNJLC3vc9ZuASY7jUfwec1JgPDRU4 NfOJGq2XZnMexQl2ilyM+u4awnvnh1CGTONgShohGucCOPWV05uPZB/wTG707HDmb/ u6wNgO7Oj1fq/FrHp123ZQ7Ayasq1NO0bDGSaTYQgEbyvUi1OMBLA9D3AZ09fBHgvs J1kKkTYee0Oht2SaXtaIiDM37VdaJ7/+ku7rffd5wqKLi6LlReIQK3K1RKmHdpSLNH E2+cjo3AJFyxw== From: Ard Biesheuvel To: linux-crypto@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, herbert@gondor.apana.org.au, keescook@chromium.org, ebiggers@kernel.org, Ard Biesheuvel Subject: [PATCH 2/4] crypto: arm64/aes-modes - use frame_push/pop macros consistently Date: Tue, 29 Nov 2022 17:48:50 +0100 Message-Id: <20221129164852.2051561-3-ardb@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221129164852.2051561-1-ardb@kernel.org> References: <20221129164852.2051561-1-ardb@kernel.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3335; i=ardb@kernel.org; h=from:subject; bh=9SaQlin5wIPSWq6g8wiEQHueYYCgsDKbOKZ0VuZfqu0=; b=owEB7QES/pANAwAKAcNPIjmS2Y8kAcsmYgBjhjfwPWjIKBspc8Vza4qzgFrGMSyTXBB7j1I4rhmM Tu1O2zOJAbMEAAEKAB0WIQT72WJ8QGnJQhU3VynDTyI5ktmPJAUCY4Y38AAKCRDDTyI5ktmPJCCADA Cp1nu/8+KaItcoizpuHj9k3Mvh6o4lGpSwkBKWXJeQjo32v6/1kI9TPrV27XEj12Ze0AJD03EYAFj7 QAh2662d/qMZsLk4jaRKt4aVZGvOMSiCiu27lCvXhHPmS4WY3OG3PzdKh6YezosVLNsS0DoIzjjnzS cxandBA9r+pLhAXm55Fv6rrBhwcNZQl1AasepJjPdTQzUdJFZiayX3m8zNkbLUVdNWd0X5ODSYl+kG o5iWgHORGS0uttwwqSGxQ5qBbkXuRwBy7qZrzCOYdA+mnin3tQy6WoP2SveeGEZYzYnXqVjCu2mVqT 1oPpIZwaWub+nYtgxuQ3035Xi484MH+oM2h5mqJXSnltWWn3sp4wLZHPl+El8Ov629crZSBhc7I5rp y70+cjtLLgnhgFLjk6gKDcpxRpgidBsV46r+NKtGedFOrATpn36wa8OEqv8NcfyGilaVve2BJOG09L yR6jtkQFViQ2ExaE7/Al/zfK5+xm5An9SyL5ZM+48bhsQ= X-Developer-Key: i=ardb@kernel.org; a=openpgp; fpr=F43D03328115A198C90016883D200E9CA6329909 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221129_084909_173657_44DB4E74 X-CRM114-Status: UNSURE ( 9.99 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use the frame_push and frame_pop macros to create the stack frames in the AES chaining mode wrappers so that they will get PAC and/or shadow call stack protection when configured. Signed-off-by: Ard Biesheuvel --- arch/arm64/crypto/aes-modes.S | 34 +++++++------------- 1 file changed, 12 insertions(+), 22 deletions(-) diff --git a/arch/arm64/crypto/aes-modes.S b/arch/arm64/crypto/aes-modes.S index 5abc834271f4a610..0e834a2c062cf265 100644 --- a/arch/arm64/crypto/aes-modes.S +++ b/arch/arm64/crypto/aes-modes.S @@ -52,8 +52,7 @@ SYM_FUNC_END(aes_decrypt_block5x) */ AES_FUNC_START(aes_ecb_encrypt) - stp x29, x30, [sp, #-16]! - mov x29, sp + frame_push 0 enc_prepare w3, x2, x5 @@ -77,14 +76,13 @@ ST5( st1 {v4.16b}, [x0], #16 ) subs w4, w4, #1 bne .Lecbencloop .Lecbencout: - ldp x29, x30, [sp], #16 + frame_pop ret AES_FUNC_END(aes_ecb_encrypt) AES_FUNC_START(aes_ecb_decrypt) - stp x29, x30, [sp, #-16]! - mov x29, sp + frame_push 0 dec_prepare w3, x2, x5 @@ -108,7 +106,7 @@ ST5( st1 {v4.16b}, [x0], #16 ) subs w4, w4, #1 bne .Lecbdecloop .Lecbdecout: - ldp x29, x30, [sp], #16 + frame_pop ret AES_FUNC_END(aes_ecb_decrypt) @@ -171,9 +169,6 @@ AES_FUNC_END(aes_cbc_encrypt) AES_FUNC_END(aes_essiv_cbc_encrypt) AES_FUNC_START(aes_essiv_cbc_decrypt) - stp x29, x30, [sp, #-16]! - mov x29, sp - ld1 {cbciv.16b}, [x5] /* get iv */ mov w8, #14 /* AES-256: 14 rounds */ @@ -182,11 +177,9 @@ AES_FUNC_START(aes_essiv_cbc_decrypt) b .Lessivcbcdecstart AES_FUNC_START(aes_cbc_decrypt) - stp x29, x30, [sp, #-16]! - mov x29, sp - ld1 {cbciv.16b}, [x5] /* get iv */ .Lessivcbcdecstart: + frame_push 0 dec_prepare w3, x2, x6 .LcbcdecloopNx: @@ -236,7 +229,7 @@ ST5( st1 {v4.16b}, [x0], #16 ) bne .Lcbcdecloop .Lcbcdecout: st1 {cbciv.16b}, [x5] /* return iv */ - ldp x29, x30, [sp], #16 + frame_pop ret AES_FUNC_END(aes_cbc_decrypt) AES_FUNC_END(aes_essiv_cbc_decrypt) @@ -337,8 +330,7 @@ AES_FUNC_END(aes_cbc_cts_decrypt) BLOCKS .req x13 BLOCKS_W .req w13 - stp x29, x30, [sp, #-16]! - mov x29, sp + frame_push 0 enc_prepare ROUNDS_W, KEY, IV_PART ld1 {vctr.16b}, [IV] @@ -481,7 +473,7 @@ ST5( st1 {v4.16b}, [OUT], #16 ) .if !\xctr st1 {vctr.16b}, [IV] /* return next CTR value */ .endif - ldp x29, x30, [sp], #16 + frame_pop ret .Lctrtail\xctr: @@ -645,8 +637,7 @@ AES_FUNC_END(aes_xctr_encrypt) .endm AES_FUNC_START(aes_xts_encrypt) - stp x29, x30, [sp, #-16]! - mov x29, sp + frame_push 0 ld1 {v4.16b}, [x6] xts_load_mask v8 @@ -704,7 +695,7 @@ AES_FUNC_START(aes_xts_encrypt) st1 {v0.16b}, [x0] .Lxtsencret: st1 {v4.16b}, [x6] - ldp x29, x30, [sp], #16 + frame_pop ret .LxtsencctsNx: @@ -732,8 +723,7 @@ AES_FUNC_START(aes_xts_encrypt) AES_FUNC_END(aes_xts_encrypt) AES_FUNC_START(aes_xts_decrypt) - stp x29, x30, [sp, #-16]! - mov x29, sp + frame_push 0 /* subtract 16 bytes if we are doing CTS */ sub w8, w4, #0x10 @@ -794,7 +784,7 @@ AES_FUNC_START(aes_xts_decrypt) b .Lxtsdecloop .Lxtsdecout: st1 {v4.16b}, [x6] - ldp x29, x30, [sp], #16 + frame_pop ret .Lxtsdeccts: From patchwork Tue Nov 29 16:48:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 13058853 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0162CC433FE for ; Tue, 29 Nov 2022 16:50:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=KY5sj0Y7j8YMwTaSwJjLPv5sLfmA0acgBycj2sE/gOc=; b=oR0WRWfcYqmUZW 1ZuzoUBh6azKyjX8J6UnSFZpO/+rVd2IwIFl4IPfqrhqkkIes/lCTRVr0icKc0M9Z9JEJlx7Fa7G6 xeOmFgBtfTjK77uk818hkKvGo4dz/iPctIclxh2K4xXU2GurWIbY8tUCWdBYCYNOAY3TFcbAubvds JFdVO46nPGT3jSrXzdFbv1wZ5y5Uvw3rdLlPAoOtwyLNpNiCfj4PuP1pFFaS97rZoJvMr03L0YrlU z5/aXH8du58Y2VfUa3toEcvtjN7hEJTbHXN8kGYbwC9zBsPmaYmFj8VhbEPoVGhpPu1zonYSk258B 4YuGf8WuVNpW+a8p0wcw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1p03nW-00AFs1-Pg; Tue, 29 Nov 2022 16:49:31 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1p03nA-00AFlN-C3 for linux-arm-kernel@lists.infradead.org; Tue, 29 Nov 2022 16:49:09 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id DE28761840; Tue, 29 Nov 2022 16:49:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 62B56C4347C; Tue, 29 Nov 2022 16:49:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669740547; bh=ZbRwMgdjVH/Qv9iqeuJCWB3YxvidsTfyQPViGNEqq1g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EeSuO3dTjzVms3bDEpHzf6u680KHgxUIlXZEEfpMZH821ItLirr5iPD2YTTn/0I64 uM4vsMqwEX6LZ1M/9ZJrkUpD0qbsQsxvO1Aak/iExpoDt/YGvC8ajM/9WvMdTObWyp 8wx67kgIThXzhTOsMk1ZwV8SJI06/6mmttXaqjNREY2sw5p4xem9OvknL5Esz0wFYS PHbePp1Kc5hRUcaflxbUYlxX460QCMOU7/DvsJMsbXi/srwNoFmTgz8k0TwANqrRMS hX8rGUSVGAktUg4sq5iFvAPCyQD1WQEkEntdjTUaGxb6CYe65z+UUqGXd98EyyP/R8 KuxfHvWRtbNaA== From: Ard Biesheuvel To: linux-crypto@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, herbert@gondor.apana.org.au, keescook@chromium.org, ebiggers@kernel.org, Ard Biesheuvel Subject: [PATCH 3/4] crypto: arm64/crct10dif - use frame_push/pop macros consistently Date: Tue, 29 Nov 2022 17:48:51 +0100 Message-Id: <20221129164852.2051561-4-ardb@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221129164852.2051561-1-ardb@kernel.org> References: <20221129164852.2051561-1-ardb@kernel.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=969; i=ardb@kernel.org; h=from:subject; bh=ZbRwMgdjVH/Qv9iqeuJCWB3YxvidsTfyQPViGNEqq1g=; b=owEB7QES/pANAwAKAcNPIjmS2Y8kAcsmYgBjhjfy6E1CYBE5bA5UpH3kQV3+cRFcI1P5dLV9IY/s RFrVwgSJAbMEAAEKAB0WIQT72WJ8QGnJQhU3VynDTyI5ktmPJAUCY4Y38gAKCRDDTyI5ktmPJNnaC/ 4sswyi115VJR32FGSYpUMS9BQWIlkfr+KNf4ZFr+UnlZdPNK7jazRVYrbAqI12bmz0NA8IIArLk/cF OxjUj0WBzb9/DuCcCl9iSyQy9P4Fk4KQqP9mGPxIEDmvh+qw5Epmesll83fIGkHa9jy3Er2JKRD9dh KsEvWjd4ul1BeCia9c9krSLmAisHQpBluTjbRnZhWYM9ilu1pzXF6d7vB7U2t19ejfevs5O8eIiKC+ e3gEdSJGphj4ZLCrYCOu1kK0oGeMXAdAnpY0Kc38bcaos03if662W05afUnocj1zkkxgYvH5DxAW5s phXYcG77CqJX5csK5+o/gzrwcPFZrW8yWpvhvMgj7nCew8tYbS7oSQ8nt5pYaUXzBb7qVEjFjivNvn LqxttqtYYrAH/QgpbmanXK3tb85ihEnMX4iav3zAjHSDWYB42W3SxkTFStdErAd7OFZpiJtP0/u80C 4/kDW3E2FYp8sa0gOB/RcWmydl+yCeRpE/BzOl4CTPyAA= X-Developer-Key: i=ardb@kernel.org; a=openpgp; fpr=F43D03328115A198C90016883D200E9CA6329909 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221129_084908_469349_75F8CF18 X-CRM114-Status: GOOD ( 10.80 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use the frame_push and frame_pop macros to set up the stack frame so that return address protections will be enabled automically when configured. Signed-off-by: Ard Biesheuvel --- arch/arm64/crypto/crct10dif-ce-core.S | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/arch/arm64/crypto/crct10dif-ce-core.S b/arch/arm64/crypto/crct10dif-ce-core.S index dce6dcebfca189ee..5604de61d06d04ee 100644 --- a/arch/arm64/crypto/crct10dif-ce-core.S +++ b/arch/arm64/crypto/crct10dif-ce-core.S @@ -429,7 +429,7 @@ CPU_LE( ext v0.16b, v0.16b, v0.16b, #8 ) umov w0, v0.h[0] .ifc \p, p8 - ldp x29, x30, [sp], #16 + frame_pop .endif ret @@ -466,8 +466,7 @@ CPU_LE( ext v7.16b, v7.16b, v7.16b, #8 ) // Assumes len >= 16. // SYM_FUNC_START(crc_t10dif_pmull_p8) - stp x29, x30, [sp, #-16]! - mov x29, sp + frame_push 1 crc_t10dif_pmull p8 SYM_FUNC_END(crc_t10dif_pmull_p8) From patchwork Tue Nov 29 16:48:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 13058855 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B5C23C433FE for ; Tue, 29 Nov 2022 16:50:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=y8I3YV0VCe2KOnVYbBSY9x+8yWMtuoNQYbl2dU4lRTo=; b=vvLmj3nnzDzK95 S4l8E7luv8CE+JQRXuYThABl3ibAP9f5JV2ypQqdcr3KoAcDdq07fXwsooKg7KhUxAaFV3O6AN7fa QPewqiJI0p+ZRuIIVoVbi5uMdB1ZD6qdZPkPVhC8vkEnOQ0+CfRqtW8POT6DSEMW9d6QXVkdj3BNW /TDf1Ou/IZjnvzewxarcTJs/s9hjpUmXsYLwleFhw+k/2kqi/EXIpbw0mMofcITpN12y03gArooKd i/t13MVjcKdYO/6ERCBl95opAKtQ5et89OOy0LzOS9GuCo3UTk9Fz45lnb6BZUdDHQ0voKHiD8C4K SlBr6VG+q/g0s5OCElIQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1p03o3-00AG4J-Pi; Tue, 29 Nov 2022 16:50:03 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1p03nC-00AFmf-EG for linux-arm-kernel@lists.infradead.org; Tue, 29 Nov 2022 16:49:11 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0EB8861811; Tue, 29 Nov 2022 16:49:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 25902C433C1; Tue, 29 Nov 2022 16:49:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669740549; bh=3Un66ME/YBPoZ24cwKV2SzyOGE4rdUdVCnXFE16r1Hk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UrPzwmJn+Uzlk2qfvMsFlHfr7nYLwjTrf8hIXl8ZGblfO3nAeBjZAZcJpBkiyAO+0 Og7nddGuFBk5xEXTjQ1ilIp1suOjIrWzpAbFIBAQ/U8u61HudlCu+B3fWeorzqLG6I Wi6ix9L+hL/8xXtWeybFbMeEMqzQVpE8ySR4zTa5+yXPqeDjdvNiY4MWKvWpr3u3bj jmUci7kl9k1Y/oh4i0UHEacHbfygFhoz58U3k6/OcbnpQ4bzQdqnq9XNEoepu/jvzd PLyf9PQfJEPtcxi4LQHraKlfhmUNsJUm+DFzDNo7JqszSZwyor76L2FWOrGLigHC4u 2l1cbiZqFvDyw== From: Ard Biesheuvel To: linux-crypto@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, herbert@gondor.apana.org.au, keescook@chromium.org, ebiggers@kernel.org, Ard Biesheuvel Subject: [PATCH 4/4] crypto: arm64/ghash-ce - use frame_push/pop macros consistently Date: Tue, 29 Nov 2022 17:48:52 +0100 Message-Id: <20221129164852.2051561-5-ardb@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221129164852.2051561-1-ardb@kernel.org> References: <20221129164852.2051561-1-ardb@kernel.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1139; i=ardb@kernel.org; h=from:subject; bh=3Un66ME/YBPoZ24cwKV2SzyOGE4rdUdVCnXFE16r1Hk=; b=owEB7QES/pANAwAKAcNPIjmS2Y8kAcsmYgBjhjfz7YFBiwxd4UCpUDmgUSpDwO1YjaGw6iPNEpQA xESGIOGJAbMEAAEKAB0WIQT72WJ8QGnJQhU3VynDTyI5ktmPJAUCY4Y38wAKCRDDTyI5ktmPJFT6C/ sF5tQASYPPFPqCfks/slJwKDkEn1/KblsnebUqsqmFgYYABVWf9MJVuRJjqAjU1jxRTqfjRRcSpiRx dB2Qc7uFXi1uzSBaH2buSUDhwQZsYgdF8OI0nb+yzxEVIh0TCvfH/fXtxCTrP16Nxldah+KIf/0+At qLf34PeQfclrpvN97TuM/j4mSReZwD/yKgm0VhYhMdB+04eWwE5L+srf7kZPOETYghj7ZNu0rnAv26 yZ3bVLLOgsSy+trqMQeFxYrNUQfzpd1sVnxtcWZa9/Zbtat0xnqPUOET3hTfEj0PiAS8O5WAFWEO3f 9BAm366mdRjLzNNwVmRgPurNE5j5R+rZXCh1bUY4wSWZFjada9IX0bGVEUHGEKp6VMd50eUjeN3tkV C45MmZ3T1OKAfn4rUvjLZBzN/oYNVrVE0lr6H5Nrtjs0eek1bRM7e3V+MIIFd9MfuALtbh86SPp+M5 rrvosJOtW2uQk1M0870mDdqvZdECg7yT+efsLih8zuuHI= X-Developer-Key: i=ardb@kernel.org; a=openpgp; fpr=F43D03328115A198C90016883D200E9CA6329909 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221129_084910_564719_2CBB167A X-CRM114-Status: GOOD ( 10.73 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use the frame_push and frame_pop macros to set up the stack frame so that return address protections will be enabled automically when configured. Signed-off-by: Ard Biesheuvel --- arch/arm64/crypto/ghash-ce-core.S | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/arch/arm64/crypto/ghash-ce-core.S b/arch/arm64/crypto/ghash-ce-core.S index ebe5558929b7bba6..23ee9a5eaf27c23c 100644 --- a/arch/arm64/crypto/ghash-ce-core.S +++ b/arch/arm64/crypto/ghash-ce-core.S @@ -436,9 +436,7 @@ SYM_FUNC_END(pmull_ghash_update_p8) .align 6 .macro pmull_gcm_do_crypt, enc - stp x29, x30, [sp, #-32]! - mov x29, sp - str x19, [sp, #24] + frame_push 1 load_round_keys x7, x6, x8 @@ -529,7 +527,7 @@ CPU_LE( rev w8, w8 ) .endif bne 0b -3: ldp x19, x10, [sp, #24] +3: ldr x10, [sp, #.Lframe_local_offset] cbz x10, 5f // output tag? ld1 {INP3.16b}, [x10] // load lengths[] @@ -562,7 +560,7 @@ CPU_LE( rev w8, w8 ) smov w0, v0.b[0] // return b0 .endif -4: ldp x29, x30, [sp], #32 +4: frame_pop ret 5: