Skip to content

Commit 123ffab

Browse files
committed
x86: embed .note.gnu.property for Intel CET in assembly files
Instead of generating the note section with a linker option, this embeds it in each .S file through a preprocessor macro. The main motivation behind this is to simplify the build process when a shared library is statically linking to leancrypto. As a bonus, this mechanism could be used to support PACBTI on AArch64 in a future extension. Signed-off-by: Daiki Ueno <dueno@redhat.com> Signed-off-by: Stephan Mueller <smueller@chronox.de>
1 parent 2414e58 commit 123ffab

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+139
-6
lines changed

curve25519/src/armv7/x25519-cortex-m4-gcc.S

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1040,3 +1040,5 @@ SYM_FUNC_ENTER(crypto_scalarmult_curve25519_armv7)
10401040
// in total for whole function 548 873 cycles
10411041

10421042
SYM_FUNC_END(crypto_scalarmult_curve25519_armv7)
1043+
1044+
LC_ASM_END

curve25519/src/armv8/X25519-AArch64.S

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1641,3 +1641,5 @@ invtable:
16411641
.hword 50| (2<<9)
16421642
.hword 5| (1<<9)
16431643
.hword 0| (0<<9)
1644+
1645+
LC_ASM_END

curve25519/src/avx/curve25519_avx_asm.S

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,5 @@
3737
#if defined(__linux__) && defined(__ELF__)
3838
.section .note.GNU-stack,"",%progbits
3939
#endif
40+
41+
LC_ASM_END

hash/src/asm/ARMv8A/KeccakP-1600-armv8a-ce.S

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1039,3 +1039,5 @@ SYM_FUNC_ENTER(lc_keccak_squeeze_arm_ce)
10391039
SYM_FUNC_END(lc_keccak_squeeze_arm_ce)
10401040
.byte 75,101,99,99,97,107,45,49,54,48,48,32,97,98,115,111,114,98,32,97,110,100,32,115,113,117,101,101,122,101,32,102,111,114,32,65,82,77,118,56,44,32,67,82,89,80,84,79,71,65,77,83,32,98,121,32,60,97,112,112,114,111,64,111,112,101,110,115,115,108,46,111,114,103,62,0
10411041
.align 2
1042+
1043+
LC_ASM_END

hash/src/asm/ARMv8A/KeccakP-1600-armv8a-neon.S

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
// This implementation comes with KeccakP-1600-SnP.h in the same folder.
3232
// Please refer to LowLevel.build for the exact list of other files it must be combined with.
3333

34+
#include "assembler_support.h"
35+
3436
// INFO: Tested on Cortex-A53(odroid-c2), using gcc.
3537
// WARNING: These functions work only on little endian CPU with ARMv8a + NEON architecture
3638
// WARNING: State must be 512 bit (64 bytes) aligned.
@@ -560,3 +562,5 @@ KeccakP1600_Permute_RoundLoop:
560562
KeccakP1600_Permute_Exit:
561563
StoreState
562564
ret
565+
566+
LC_ASM_END

hash/src/asm/ARMv8A/sha2-256-ARMv8.S

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2016,3 +2016,5 @@ SYM_FUNC_ENTER(sha256_block_neon)
20162016
add sp,sp,#16*4+2*__SIZEOF_POINTER__
20172017
RET
20182018
SYM_FUNC_END(sha256_block_neon)
2019+
2020+
LC_ASM_END

hash/src/asm/ARMv8A/sha2-512-ARMv8.S

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1565,3 +1565,5 @@ SYM_FUNC_ENTER(sha512_block_armv8ce)
15651565
RET
15661566
SYM_FUNC_END(sha512_block_armv8ce)
15671567

1568+
1569+
LC_ASM_END

hash/src/asm/ARMv8_2x/keccakx2_armce.S

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,4 +194,6 @@ loop:
194194

195195
SYM_FUNC_END(keccak_f1600x2_armce)
196196

197+
LC_ASM_END
198+
197199
#endif

hash/src/asm/AVX2/KeccakP-1600-AVX2.S

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1032,3 +1032,5 @@ mask6_17:
10321032
.quad ALLON, ALLON, 0, 0
10331033

10341034
.asciz "Keccak-1600 for AVX2, CRYPTOGAMS by <appro@openssl.org>"
1035+
1036+
LC_ASM_END

hash/src/asm/AVX2/sha2-256-AVX2.S

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5495,3 +5495,5 @@ K256:
54955495
.long 0x03020100,0x0b0a0908,0xffffffff,0xffffffff
54965496
.long 0xffffffff,0xffffffff,0x03020100,0x0b0a0908
54975497
.long 0xffffffff,0xffffffff,0x03020100,0x0b0a0908
5498+
5499+
LC_ASM_END

0 commit comments

Comments
 (0)