Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

crypto: arm64/aes-modes - use frame_push/pop macros consistently

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 <ardb@kernel.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Ard Biesheuvel and committed by
Herbert Xu
7d709af1 67ab02dc

+12 -22
+12 -22
arch/arm64/crypto/aes-modes.S
··· 52 52 */ 53 53 54 54 AES_FUNC_START(aes_ecb_encrypt) 55 - stp x29, x30, [sp, #-16]! 56 - mov x29, sp 55 + frame_push 0 57 56 58 57 enc_prepare w3, x2, x5 59 58 ··· 76 77 subs w4, w4, #1 77 78 bne .Lecbencloop 78 79 .Lecbencout: 79 - ldp x29, x30, [sp], #16 80 + frame_pop 80 81 ret 81 82 AES_FUNC_END(aes_ecb_encrypt) 82 83 83 84 84 85 AES_FUNC_START(aes_ecb_decrypt) 85 - stp x29, x30, [sp, #-16]! 86 - mov x29, sp 86 + frame_push 0 87 87 88 88 dec_prepare w3, x2, x5 89 89 ··· 106 108 subs w4, w4, #1 107 109 bne .Lecbdecloop 108 110 .Lecbdecout: 109 - ldp x29, x30, [sp], #16 111 + frame_pop 110 112 ret 111 113 AES_FUNC_END(aes_ecb_decrypt) 112 114 ··· 169 171 AES_FUNC_END(aes_essiv_cbc_encrypt) 170 172 171 173 AES_FUNC_START(aes_essiv_cbc_decrypt) 172 - stp x29, x30, [sp, #-16]! 173 - mov x29, sp 174 - 175 174 ld1 {cbciv.16b}, [x5] /* get iv */ 176 175 177 176 mov w8, #14 /* AES-256: 14 rounds */ ··· 177 182 b .Lessivcbcdecstart 178 183 179 184 AES_FUNC_START(aes_cbc_decrypt) 180 - stp x29, x30, [sp, #-16]! 181 - mov x29, sp 182 - 183 185 ld1 {cbciv.16b}, [x5] /* get iv */ 184 186 .Lessivcbcdecstart: 187 + frame_push 0 185 188 dec_prepare w3, x2, x6 186 189 187 190 .LcbcdecloopNx: ··· 229 236 bne .Lcbcdecloop 230 237 .Lcbcdecout: 231 238 st1 {cbciv.16b}, [x5] /* return iv */ 232 - ldp x29, x30, [sp], #16 239 + frame_pop 233 240 ret 234 241 AES_FUNC_END(aes_cbc_decrypt) 235 242 AES_FUNC_END(aes_essiv_cbc_decrypt) ··· 330 337 BLOCKS .req x13 331 338 BLOCKS_W .req w13 332 339 333 - stp x29, x30, [sp, #-16]! 334 - mov x29, sp 340 + frame_push 0 335 341 336 342 enc_prepare ROUNDS_W, KEY, IV_PART 337 343 ld1 {vctr.16b}, [IV] ··· 473 481 .if !\xctr 474 482 st1 {vctr.16b}, [IV] /* return next CTR value */ 475 483 .endif 476 - ldp x29, x30, [sp], #16 484 + frame_pop 477 485 ret 478 486 479 487 .Lctrtail\xctr: ··· 637 645 .endm 638 646 639 647 AES_FUNC_START(aes_xts_encrypt) 640 - stp x29, x30, [sp, #-16]! 641 - mov x29, sp 648 + frame_push 0 642 649 643 650 ld1 {v4.16b}, [x6] 644 651 xts_load_mask v8 ··· 695 704 st1 {v0.16b}, [x0] 696 705 .Lxtsencret: 697 706 st1 {v4.16b}, [x6] 698 - ldp x29, x30, [sp], #16 707 + frame_pop 699 708 ret 700 709 701 710 .LxtsencctsNx: ··· 723 732 AES_FUNC_END(aes_xts_encrypt) 724 733 725 734 AES_FUNC_START(aes_xts_decrypt) 726 - stp x29, x30, [sp, #-16]! 727 - mov x29, sp 735 + frame_push 0 728 736 729 737 /* subtract 16 bytes if we are doing CTS */ 730 738 sub w8, w4, #0x10 ··· 784 794 b .Lxtsdecloop 785 795 .Lxtsdecout: 786 796 st1 {v4.16b}, [x6] 787 - ldp x29, x30, [sp], #16 797 + frame_pop 788 798 ret 789 799 790 800 .Lxtsdeccts: