Move Keccak rhotates tables to rodata
authorAmir Ayupov <fads93@gmail.com>
Wed, 12 Jul 2023 22:14:51 +0000 (15:14 -0700)
committerPauli <pauli@openssl.org>
Fri, 14 Jul 2023 01:15:45 +0000 (11:15 +1000)
rhotates tables are placed to .text section which confuses tools such as BOLT.
Move them to rodata to unbreak and avoid polluting icache/iTLB with data.

CLA: trivial

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Paul Yang <kaishen.yy@antfin.com>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21440)

crypto/sha/asm/keccak1600-avx2.pl
crypto/sha/asm/keccak1600-avx512.pl
crypto/sha/asm/keccak1600-avx512vl.pl

index 84682289bf7a711187c903066c6d2326e57496f7..4fa3f787fa80b6a0e86544a7fb0faa0955355658 100755 (executable)
@@ -432,6 +432,7 @@ $code.=<<___;
        ret
 .size  SHA3_squeeze,.-SHA3_squeeze
 
+.section .rodata
 .align 64
 rhotates_left:
        .quad   3,      18,     36,     41      # [2][0] [4][0] [1][0] [3][0]
index 85d6e7ffe424aaeb6f7655ea00482e057f2f7245..8bcf3a0804157b73b9729da7d4294da9d71d0c9c 100755 (executable)
@@ -486,6 +486,7 @@ SHA3_squeeze:
        ret
 .size  SHA3_squeeze,.-SHA3_squeeze
 
+.section .rodata
 .align 64
 theta_perm:
        .quad   0, 1, 2, 3, 4, 5, 6, 7          # [not used]
index 73e75f363f2041872bed3fea80a900f8711ecfb9..da93faa53941a4e1152a4e05597d754591ab9688 100755 (executable)
@@ -349,6 +349,7 @@ $code.=<<___;
        ret
 .size  SHA3_squeeze,.-SHA3_squeeze
 
+.section .rodata
 .align 64
 rhotates_left:
        .quad   3,      18,     36,     41      # [2][0] [4][0] [1][0] [3][0]