Skip to content

Commit debc1e5

Browse files
author
Eric Biggers
committed
lib/crypto: arm64/sha512-ce: Drop compatibility macros for older binutils
Now that the oldest supported binutils version is 2.30, the macros that emit the SHA-512 instructions as '.inst' words are no longer needed. So drop them. No change in the generated machine code. Changed from the original patch by Ard Biesheuvel: (https://lore.kernel.org/r/20250515142702.2592942-2-ardb+git@google.com): - Reduced scope to just SHA-512 - Added comment that explains why "sha3" is used instead of "sha2" Acked-by: Ard Biesheuvel <ardb@kernel.org> Link: https://lore.kernel.org/r/20250718220706.475240-1-ebiggers@kernel.org Signed-off-by: Eric Biggers <ebiggers@kernel.org>
1 parent 42e3376 commit debc1e5

1 file changed

Lines changed: 11 additions & 20 deletions

File tree

lib/crypto/arm64/sha512-ce-core.S

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,17 @@
1212
#include <linux/linkage.h>
1313
#include <asm/assembler.h>
1414

15-
.irp b,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19
16-
.set .Lq\b, \b
17-
.set .Lv\b\().2d, \b
18-
.endr
19-
20-
.macro sha512h, rd, rn, rm
21-
.inst 0xce608000 | .L\rd | (.L\rn << 5) | (.L\rm << 16)
22-
.endm
23-
24-
.macro sha512h2, rd, rn, rm
25-
.inst 0xce608400 | .L\rd | (.L\rn << 5) | (.L\rm << 16)
26-
.endm
27-
28-
.macro sha512su0, rd, rn
29-
.inst 0xcec08000 | .L\rd | (.L\rn << 5)
30-
.endm
31-
32-
.macro sha512su1, rd, rn, rm
33-
.inst 0xce608800 | .L\rd | (.L\rn << 5) | (.L\rm << 16)
34-
.endm
15+
/*
16+
* We have to specify the "sha3" feature here, since the GNU and clang
17+
* assemblers both consider the SHA-512 instructions to be part of the
18+
* "sha3" feature. (Except binutils 2.30 through 2.42, which used
19+
* "sha2". But "sha3" implies "sha2", so "sha3" still works in those
20+
* versions.) "sha3" doesn't make a lot of sense, since SHA-512 is part
21+
* of the SHA-2 family of algorithms, and also the Arm Architecture
22+
* Reference Manual defines FEAT_SHA512 and FEAT_SHA3 separately.
23+
* Regardless, we must use "sha3" to be compatible with the assemblers.
24+
*/
25+
.arch armv8-a+sha3
3526

3627
/*
3728
* The SHA-512 round constants

0 commit comments

Comments
 (0)