Skip to content

Commit 1d1ca79

Browse files
zorrorffmt8m
authored andcommitted
Preserve callee-saved registers in aarch64 AES-CTR code
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 Reviewed-by: Shane Lontis <[email protected]> Reviewed-by: Tomas Mraz <[email protected]> (Merged from #23233)
1 parent 806bbaf commit 1d1ca79

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

crypto/aes/asm/aesv8-armx.pl

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1780,8 +1780,12 @@ ()
17801780
${prefix}_ctr32_encrypt_blocks_unroll12_eor3:
17811781
AARCH64_VALID_CALL_TARGET
17821782
// Armv8.3-A PAuth: even though x30 is pushed to stack it is not popped later.
1783-
stp x29,x30,[sp,#-16]!
1784-
add x29,sp,#0
1783+
stp x29,x30,[sp,#-80]!
1784+
stp d8,d9,[sp, #16]
1785+
stp d10,d11,[sp, #32]
1786+
stp d12,d13,[sp, #48]
1787+
stp d14,d15,[sp, #64]
1788+
add x29,sp,#0
17851789
17861790
ldr $rounds,[$key,#240]
17871791
@@ -2486,7 +2490,11 @@ ()
24862490
vst1.8 {$in0},[$out],#16
24872491
24882492
.Lctr32_done_unroll:
2489-
ldr x29,[sp],#16
2493+
ldp d8,d9,[sp, #16]
2494+
ldp d10,d11,[sp, #32]
2495+
ldp d12,d13,[sp, #48]
2496+
ldp d15,d16,[sp, #64]
2497+
ldr x29,[sp],#80
24902498
ret
24912499
.size ${prefix}_ctr32_encrypt_blocks_unroll12_eor3,.-${prefix}_ctr32_encrypt_blocks_unroll12_eor3
24922500
___

0 commit comments

Comments
 (0)