Skip to content

Commit a068b94

Browse files
ebiggersherbertx
authored andcommitted
crypto: arm/speck - fix building in Thumb2 mode
Building the kernel with CONFIG_THUMB2_KERNEL=y and CONFIG_CRYPTO_SPECK_NEON set fails with the following errors: arch/arm/crypto/speck-neon-core.S: Assembler messages: arch/arm/crypto/speck-neon-core.S:419: Error: r13 not allowed here -- `bic sp,#0xf' arch/arm/crypto/speck-neon-core.S:423: Error: r13 not allowed here -- `bic sp,#0xf' arch/arm/crypto/speck-neon-core.S:427: Error: r13 not allowed here -- `bic sp,#0xf' arch/arm/crypto/speck-neon-core.S:431: Error: r13 not allowed here -- `bic sp,#0xf' The problem is that the 'bic' instruction can't operate on the 'sp' register in Thumb2 mode. Fix it by using a temporary register. This isn't in the main loop, so the performance difference is negligible. This also matches what aes-neonbs-core.S does. Reported-by: Stefan Agner <[email protected]> Fixes: ede9622 ("crypto: arm/speck - add NEON-accelerated implementation of Speck-XTS") Signed-off-by: Eric Biggers <[email protected]> Acked-by: Ard Biesheuvel <[email protected]> Reviewed-by: Stefan Agner <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent 837bf7c commit a068b94

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

arch/arm/crypto/speck-neon-core.S

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,9 +272,11 @@
272272
* Allocate stack space to store 128 bytes worth of tweaks. For
273273
* performance, this space is aligned to a 16-byte boundary so that we
274274
* can use the load/store instructions that declare 16-byte alignment.
275+
* For Thumb2 compatibility, don't do the 'bic' directly on 'sp'.
275276
*/
276-
sub sp, #128
277-
bic sp, #0xf
277+
sub r12, sp, #128
278+
bic r12, #0xf
279+
mov sp, r12
278280

279281
.if \n == 64
280282
// Load first tweak

0 commit comments

Comments
 (0)