Skip to content

Commit

Permalink
Preserve callee-saved registers in aarch64 AES-CTR code
Browse files Browse the repository at this point in the history
The AES-CTR assembly code uses v8-v15 registers, they are
callee-saved registers, they must be preserved before the
use and restored after the use.

Change-Id: If9192d1f0f3cea7295f4b0d72ace88e6e8067493
  • Loading branch information
zorrorffm authored and tom-cosgrove-arm committed Jan 8, 2024
1 parent 0a22436 commit e7c4b63
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions crypto/aes/asm/aesv8-armx.pl
Original file line number Diff line number Diff line change
Expand Up @@ -1780,8 +1780,12 @@ ()
${prefix}_ctr32_encrypt_blocks_unroll12_eor3:
AARCH64_VALID_CALL_TARGET
// Armv8.3-A PAuth: even though x30 is pushed to stack it is not popped later.
stp x29,x30,[sp,#-16]!
add x29,sp,#0
stp x29,x30,[sp,#-80]!
stp d8,d9,[sp, #16]
stp d10,d11,[sp, #32]
stp d12,d13,[sp, #48]
stp d14,d15,[sp, #64]
add x29,sp,#0
ldr $rounds,[$key,#240]
Expand Down Expand Up @@ -2486,7 +2490,11 @@ ()
vst1.8 {$in0},[$out],#16
.Lctr32_done_unroll:
ldr x29,[sp],#16
ldp d8,d9,[sp, #16]
ldp d10,d11,[sp, #32]
ldp d12,d13,[sp, #48]
ldp d15,d16,[sp, #64]
ldr x29,[sp],#80
ret
.size ${prefix}_ctr32_encrypt_blocks_unroll12_eor3,.-${prefix}_ctr32_encrypt_blocks_unroll12_eor3
___
Expand Down

0 comments on commit e7c4b63

Please sign in to comment.