Commit 7d709af1 authored by Ard Biesheuvel's avatar Ard Biesheuvel Committed by Herbert Xu

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: default avatarArd Biesheuvel <ardb@kernel.org>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 67ab02dc
...@@ -52,8 +52,7 @@ SYM_FUNC_END(aes_decrypt_block5x) ...@@ -52,8 +52,7 @@ SYM_FUNC_END(aes_decrypt_block5x)
*/ */
AES_FUNC_START(aes_ecb_encrypt) AES_FUNC_START(aes_ecb_encrypt)
stp x29, x30, [sp, #-16]! frame_push 0
mov x29, sp
enc_prepare w3, x2, x5 enc_prepare w3, x2, x5
...@@ -77,14 +76,13 @@ ST5( st1 {v4.16b}, [x0], #16 ) ...@@ -77,14 +76,13 @@ ST5( st1 {v4.16b}, [x0], #16 )
subs w4, w4, #1 subs w4, w4, #1
bne .Lecbencloop bne .Lecbencloop
.Lecbencout: .Lecbencout:
ldp x29, x30, [sp], #16 frame_pop
ret ret
AES_FUNC_END(aes_ecb_encrypt) AES_FUNC_END(aes_ecb_encrypt)
AES_FUNC_START(aes_ecb_decrypt) AES_FUNC_START(aes_ecb_decrypt)
stp x29, x30, [sp, #-16]! frame_push 0
mov x29, sp
dec_prepare w3, x2, x5 dec_prepare w3, x2, x5
...@@ -108,7 +106,7 @@ ST5( st1 {v4.16b}, [x0], #16 ) ...@@ -108,7 +106,7 @@ ST5( st1 {v4.16b}, [x0], #16 )
subs w4, w4, #1 subs w4, w4, #1
bne .Lecbdecloop bne .Lecbdecloop
.Lecbdecout: .Lecbdecout:
ldp x29, x30, [sp], #16 frame_pop
ret ret
AES_FUNC_END(aes_ecb_decrypt) AES_FUNC_END(aes_ecb_decrypt)
...@@ -171,9 +169,6 @@ AES_FUNC_END(aes_cbc_encrypt) ...@@ -171,9 +169,6 @@ AES_FUNC_END(aes_cbc_encrypt)
AES_FUNC_END(aes_essiv_cbc_encrypt) AES_FUNC_END(aes_essiv_cbc_encrypt)
AES_FUNC_START(aes_essiv_cbc_decrypt) AES_FUNC_START(aes_essiv_cbc_decrypt)
stp x29, x30, [sp, #-16]!
mov x29, sp
ld1 {cbciv.16b}, [x5] /* get iv */ ld1 {cbciv.16b}, [x5] /* get iv */
mov w8, #14 /* AES-256: 14 rounds */ mov w8, #14 /* AES-256: 14 rounds */
...@@ -182,11 +177,9 @@ AES_FUNC_START(aes_essiv_cbc_decrypt) ...@@ -182,11 +177,9 @@ AES_FUNC_START(aes_essiv_cbc_decrypt)
b .Lessivcbcdecstart b .Lessivcbcdecstart
AES_FUNC_START(aes_cbc_decrypt) AES_FUNC_START(aes_cbc_decrypt)
stp x29, x30, [sp, #-16]!
mov x29, sp
ld1 {cbciv.16b}, [x5] /* get iv */ ld1 {cbciv.16b}, [x5] /* get iv */
.Lessivcbcdecstart: .Lessivcbcdecstart:
frame_push 0
dec_prepare w3, x2, x6 dec_prepare w3, x2, x6
.LcbcdecloopNx: .LcbcdecloopNx:
...@@ -236,7 +229,7 @@ ST5( st1 {v4.16b}, [x0], #16 ) ...@@ -236,7 +229,7 @@ ST5( st1 {v4.16b}, [x0], #16 )
bne .Lcbcdecloop bne .Lcbcdecloop
.Lcbcdecout: .Lcbcdecout:
st1 {cbciv.16b}, [x5] /* return iv */ st1 {cbciv.16b}, [x5] /* return iv */
ldp x29, x30, [sp], #16 frame_pop
ret ret
AES_FUNC_END(aes_cbc_decrypt) AES_FUNC_END(aes_cbc_decrypt)
AES_FUNC_END(aes_essiv_cbc_decrypt) AES_FUNC_END(aes_essiv_cbc_decrypt)
...@@ -337,8 +330,7 @@ AES_FUNC_END(aes_cbc_cts_decrypt) ...@@ -337,8 +330,7 @@ AES_FUNC_END(aes_cbc_cts_decrypt)
BLOCKS .req x13 BLOCKS .req x13
BLOCKS_W .req w13 BLOCKS_W .req w13
stp x29, x30, [sp, #-16]! frame_push 0
mov x29, sp
enc_prepare ROUNDS_W, KEY, IV_PART enc_prepare ROUNDS_W, KEY, IV_PART
ld1 {vctr.16b}, [IV] ld1 {vctr.16b}, [IV]
...@@ -481,7 +473,7 @@ ST5( st1 {v4.16b}, [OUT], #16 ) ...@@ -481,7 +473,7 @@ ST5( st1 {v4.16b}, [OUT], #16 )
.if !\xctr .if !\xctr
st1 {vctr.16b}, [IV] /* return next CTR value */ st1 {vctr.16b}, [IV] /* return next CTR value */
.endif .endif
ldp x29, x30, [sp], #16 frame_pop
ret ret
.Lctrtail\xctr: .Lctrtail\xctr:
...@@ -645,8 +637,7 @@ AES_FUNC_END(aes_xctr_encrypt) ...@@ -645,8 +637,7 @@ AES_FUNC_END(aes_xctr_encrypt)
.endm .endm
AES_FUNC_START(aes_xts_encrypt) AES_FUNC_START(aes_xts_encrypt)
stp x29, x30, [sp, #-16]! frame_push 0
mov x29, sp
ld1 {v4.16b}, [x6] ld1 {v4.16b}, [x6]
xts_load_mask v8 xts_load_mask v8
...@@ -704,7 +695,7 @@ AES_FUNC_START(aes_xts_encrypt) ...@@ -704,7 +695,7 @@ AES_FUNC_START(aes_xts_encrypt)
st1 {v0.16b}, [x0] st1 {v0.16b}, [x0]
.Lxtsencret: .Lxtsencret:
st1 {v4.16b}, [x6] st1 {v4.16b}, [x6]
ldp x29, x30, [sp], #16 frame_pop
ret ret
.LxtsencctsNx: .LxtsencctsNx:
...@@ -732,8 +723,7 @@ AES_FUNC_START(aes_xts_encrypt) ...@@ -732,8 +723,7 @@ AES_FUNC_START(aes_xts_encrypt)
AES_FUNC_END(aes_xts_encrypt) AES_FUNC_END(aes_xts_encrypt)
AES_FUNC_START(aes_xts_decrypt) AES_FUNC_START(aes_xts_decrypt)
stp x29, x30, [sp, #-16]! frame_push 0
mov x29, sp
/* subtract 16 bytes if we are doing CTS */ /* subtract 16 bytes if we are doing CTS */
sub w8, w4, #0x10 sub w8, w4, #0x10
...@@ -794,7 +784,7 @@ AES_FUNC_START(aes_xts_decrypt) ...@@ -794,7 +784,7 @@ AES_FUNC_START(aes_xts_decrypt)
b .Lxtsdecloop b .Lxtsdecloop
.Lxtsdecout: .Lxtsdecout:
st1 {v4.16b}, [x6] st1 {v4.16b}, [x6]
ldp x29, x30, [sp], #16 frame_pop
ret ret
.Lxtsdeccts: .Lxtsdeccts:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment