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: 13058859 X-Patchwork-Delegate: herbert@gondor.apana.org.au 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A98E9C4167B for ; Tue, 29 Nov 2022 16:55:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236304AbiK2QzK (ORCPT ); Tue, 29 Nov 2022 11:55:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236296AbiK2Qyp (ORCPT ); Tue, 29 Nov 2022 11:54:45 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D7BB06D97F for ; Tue, 29 Nov 2022 08:49:50 -0800 (PST) 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 7D254B816E6 for ; 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 Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.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: 13058856 X-Patchwork-Delegate: herbert@gondor.apana.org.au 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2CEFEC433FE for ; Tue, 29 Nov 2022 16:54:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236452AbiK2Qyr (ORCPT ); Tue, 29 Nov 2022 11:54:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236311AbiK2QyQ (ORCPT ); Tue, 29 Nov 2022 11:54:16 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F29656D485 for ; Tue, 29 Nov 2022 08:49:34 -0800 (PST) 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 89BBE617F5 for ; Tue, 29 Nov 2022 16:49:06 +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 Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.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: 13058858 X-Patchwork-Delegate: herbert@gondor.apana.org.au 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 64B79C4332F for ; Tue, 29 Nov 2022 16:55:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236477AbiK2QzJ (ORCPT ); Tue, 29 Nov 2022 11:55:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235760AbiK2Qyh (ORCPT ); Tue, 29 Nov 2022 11:54:37 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 76C956314E for ; Tue, 29 Nov 2022 08:49:49 -0800 (PST) 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 F3204B816AA for ; Tue, 29 Nov 2022 16:49:08 +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 Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.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: 13058860 X-Patchwork-Delegate: herbert@gondor.apana.org.au 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 86297C4332F for ; Tue, 29 Nov 2022 16:55:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236311AbiK2QzU (ORCPT ); Tue, 29 Nov 2022 11:55:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236453AbiK2Qyr (ORCPT ); Tue, 29 Nov 2022 11:54:47 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4805A6C731 for ; Tue, 29 Nov 2022 08:49:58 -0800 (PST) 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 AD360B816D7 for ; 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 Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.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: