libgcrypt: amd64 assembly fixes for x-only.

This commit is contained in:
tb 2023-01-19 17:11:02 +00:00
parent d7fd0260f8
commit 47f5cec607
19 changed files with 306 additions and 1 deletions

View File

@ -1,7 +1,7 @@
COMMENT= crypto library based on code used in GnuPG
DISTNAME= libgcrypt-1.10.1
REVISION= 3
REVISION= 4
CATEGORIES= security
SHARED_LIBS += gcrypt 21.0 # 24.1

View File

@ -0,0 +1,19 @@
Index: cipher/blake2b-amd64-avx2.S
--- cipher/blake2b-amd64-avx2.S.orig
+++ cipher/blake2b-amd64-avx2.S
@@ -185,6 +185,7 @@
G2(ROW1, ROW2, ROW3, ROW4, m4); \
UNDIAGONALIZE(ROW1, ROW2, ROW3, ROW4);
+.rodata
blake2b_data:
.align 32
.Liv:
@@ -197,6 +198,7 @@ blake2b_data:
.Lshuf_ror24:
.byte 3, 4, 5, 6, 7, 0, 1, 2, 11, 12, 13, 14, 15, 8, 9, 10
+.text
.align 64
.globl _gcry_blake2b_transform_amd64_avx2
ELF(.type _gcry_blake2b_transform_amd64_avx2,@function;)

View File

@ -0,0 +1,20 @@
Index: cipher/blake2s-amd64-avx.S
--- cipher/blake2s-amd64-avx.S.orig
+++ cipher/blake2s-amd64-avx.S
@@ -171,6 +171,7 @@
G2(ROW1, ROW2, ROW3, ROW4, m4); \
UNDIAGONALIZE(ROW1, ROW2, ROW3, ROW4);
+.rodata
blake2s_data:
.align 16
.Liv:
@@ -180,7 +181,7 @@ blake2s_data:
.byte 2,3,0,1,6,7,4,5,10,11,8,9,14,15,12,13
.Lshuf_ror8:
.byte 1,2,3,0,5,6,7,4,9,10,11,8,13,14,15,12
-
+.previous
.align 64
.globl _gcry_blake2s_transform_amd64_avx
ELF(.type _gcry_blake2s_transform_amd64_avx,@function;)

View File

@ -0,0 +1,38 @@
Index: cipher/camellia-aesni-avx-amd64.S
--- cipher/camellia-aesni-avx-amd64.S.orig
+++ cipher/camellia-aesni-avx-amd64.S
@@ -619,7 +619,7 @@
vmovdqu y6, 14 * 16(rio); \
vmovdqu y7, 15 * 16(rio);
-.text
+.rodata
.align 16
#define SHUFB_BYTES(idx) \
@@ -764,6 +764,7 @@
.long 0x0f0f0f0f
+.previous
.align 8
ELF(.type __camellia_enc_blk16,@function;)
@@ -1720,7 +1721,7 @@ ELF(.size _gcry_camellia_aesni_avx_ocb_auth,.-_gcry_ca
vpsllq $(64-(nror)), out, out; \
vpaddd t0, out, out;
-
+.rodata
.align 16
.Linv_shift_row_and_unpcklbw:
.byte 0x00, 0xff, 0x0d, 0xff, 0x0a, 0xff, 0x07, 0xff
@@ -1752,7 +1753,7 @@ ELF(.size _gcry_camellia_aesni_avx_ocb_auth,.-_gcry_ca
.Lsigma6:
.long 0xB3E6C1FD, 0xB05688C2;
-
+.previous
.align 8
ELF(.type __camellia_avx_setup128,@function;)
__camellia_avx_setup128:

View File

@ -0,0 +1,21 @@
Index: cipher/camellia-aesni-avx2-amd64.h
--- cipher/camellia-aesni-avx2-amd64.h.orig
+++ cipher/camellia-aesni-avx2-amd64.h
@@ -617,7 +617,7 @@
vmovdqu y6, 14 * 32(rio); \
vmovdqu y7, 15 * 32(rio);
-.text
+.rodata
.align 32
#define SHUFB_BYTES(idx) \
@@ -756,7 +756,7 @@
.L0f0f0f0f:
.long 0x0f0f0f0f
-
+.previous
.align 8
ELF(.type __camellia_enc_blk32,@function;)

View File

@ -0,0 +1,19 @@
Index: cipher/chacha20-amd64-avx2.S
--- cipher/chacha20-amd64-avx2.S.orig
+++ cipher/chacha20-amd64-avx2.S
@@ -157,6 +157,7 @@
PLUS(c1,d1); PLUS(c2,d2); XOR(b1,c1); XOR(b2,c2); \
ROTATE2(b1, b2, 7, tmp1);
+.rodata
.align 32
chacha20_data:
.Lshuf_rol16:
@@ -167,6 +168,7 @@ chacha20_data:
.byte 0,1,2,3,4,5,6,7
.Lunsigned_cmp:
.long 0x80000000
+.previous
.align 8
.globl _gcry_chacha20_amd64_avx2_blocks8

View File

@ -0,0 +1,19 @@
Index: cipher/chacha20-amd64-ssse3.S
--- cipher/chacha20-amd64-ssse3.S.orig
+++ cipher/chacha20-amd64-ssse3.S
@@ -151,6 +151,7 @@
PLUS(c1,d1); PLUS(c2,d2); XOR(b1,c1); XOR(b2,c2); \
ROTATE2(b1, b2, 7, tmp1, tmp2);
+.rodata
chacha20_data:
.align 16
.Lshuf_rol16:
@@ -164,6 +165,7 @@ chacha20_data:
.Lunsigned_cmp:
.long 0x80000000,0x80000000,0x80000000,0x80000000
+.previous
.align 8
.globl _gcry_chacha20_amd64_ssse3_blocks4
ELF(.type _gcry_chacha20_amd64_ssse3_blocks4,@function;)

View File

@ -0,0 +1,11 @@
Index: cipher/des-amd64.S
--- cipher/des-amd64.S.orig
+++ cipher/des-amd64.S
@@ -841,6 +841,7 @@ _gcry_3des_amd64_cfb_dec:
CFI_ENDPROC();
ELF(.size _gcry_3des_amd64_cfb_dec,.-_gcry_3des_amd64_cfb_dec;)
+.rodata
.align 16
.L_s1:
.quad 0x0010100001010400, 0x0000000000000000

View File

@ -0,0 +1,11 @@
Index: cipher/rijndael-ssse3-amd64-asm.S
--- cipher/rijndael-ssse3-amd64-asm.S.orig
+++ cipher/rijndael-ssse3-amd64-asm.S
@@ -689,6 +689,7 @@ ELF(.size _gcry_aes_ssse3_schedule_core,.-_gcry_aes_ss
## ##
########################################################
+.rodata
.align 16
ELF(.type _aes_consts,@object)
.Laes_consts:

View File

@ -0,0 +1,11 @@
Index: cipher/rijndael-vaes-avx2-amd64.S
--- cipher/rijndael-vaes-avx2-amd64.S.orig
+++ cipher/rijndael-vaes-avx2-amd64.S
@@ -2926,6 +2926,7 @@ ELF(.size _gcry_vaes_avx2_xts_crypt_amd64,.-_gcry_vaes
/**********************************************************************
constants
**********************************************************************/
+.rodata
ELF(.type _gcry_vaes_consts,@object)
_gcry_vaes_consts:
.align 32

View File

@ -0,0 +1,11 @@
Index: cipher/serpent-avx2-amd64.S
--- cipher/serpent-avx2-amd64.S.orig
+++ cipher/serpent-avx2-amd64.S
@@ -1150,6 +1150,7 @@ _gcry_serpent_avx2_ocb_auth:
CFI_ENDPROC();
ELF(.size _gcry_serpent_avx2_ocb_auth,.-_gcry_serpent_avx2_ocb_auth;)
+.rodata
.align 16
/* For CTR-mode IV byteswap */

View File

@ -0,0 +1,20 @@
Index: cipher/sha1-avx-amd64.S
--- cipher/sha1-avx-amd64.S.orig
+++ cipher/sha1-avx-amd64.S
@@ -47,7 +47,7 @@
/* Constants */
-.text
+.rodata
#define K1 0x5A827999
#define K2 0x6ED9EBA1
#define K3 0x8F1BBCDC
@@ -203,6 +203,7 @@
* _gcry_sha1_transform_amd64_avx (void *ctx, const unsigned char *data,
* size_t nblks)
*/
+.text
.globl _gcry_sha1_transform_amd64_avx
ELF(.type _gcry_sha1_transform_amd64_avx,@function)
.align 16

View File

@ -0,0 +1,20 @@
Index: cipher/sha1-avx-bmi2-amd64.S
--- cipher/sha1-avx-bmi2-amd64.S.orig
+++ cipher/sha1-avx-bmi2-amd64.S
@@ -48,7 +48,7 @@
/* Constants */
-.text
+.rodata
.align 16
.Lbswap_shufb_ctl:
.long 0x00010203, 0x04050607, 0x08090a0b, 0x0c0d0e0f
@@ -202,6 +202,7 @@
* _gcry_sha1_transform_amd64_avx_bmi2 (void *ctx, const unsigned char *data,
* size_t nblks)
*/
+.text
.globl _gcry_sha1_transform_amd64_avx_bmi2
ELF(.type _gcry_sha1_transform_amd64_avx_bmi2,@function)
.align 16

View File

@ -0,0 +1,20 @@
Index: cipher/sha1-ssse3-amd64.S
--- cipher/sha1-ssse3-amd64.S.orig
+++ cipher/sha1-ssse3-amd64.S
@@ -47,7 +47,7 @@
/* Constants */
-.text
+.rodata
#define K1 0x5A827999
#define K2 0x6ED9EBA1
#define K3 0x8F1BBCDC
@@ -215,6 +215,7 @@
* _gcry_sha1_transform_amd64_ssse3 (void *ctx, const unsigned char *data,
* size_t nblks)
*/
+.text
.globl _gcry_sha1_transform_amd64_ssse3
ELF(.type _gcry_sha1_transform_amd64_ssse3,@function)
.align 16

View File

@ -0,0 +1,11 @@
Index: cipher/sha256-avx2-bmi2-amd64.S
--- cipher/sha256-avx2-bmi2-amd64.S.orig
+++ cipher/sha256-avx2-bmi2-amd64.S
@@ -477,6 +477,7 @@ _gcry_sha256_transform_amd64_avx2:
ret_spec_stop
CFI_ENDPROC()
+.rodata
.align 64
.LK256:
.long 0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5

View File

@ -0,0 +1,12 @@
Index: cipher/sha256-ssse3-amd64.S
--- cipher/sha256-ssse3-amd64.S.orig
+++ cipher/sha256-ssse3-amd64.S
@@ -496,7 +496,7 @@ _gcry_sha256_transform_amd64_ssse3:
ret_spec_stop
CFI_ENDPROC()
-
+.rodata
.align 16
.LK256:
.long 0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5

View File

@ -0,0 +1,11 @@
Index: cipher/sha512-ssse3-amd64.S
--- cipher/sha512-ssse3-amd64.S.orig
+++ cipher/sha512-ssse3-amd64.S
@@ -414,6 +414,7 @@ _gcry_sha512_transform_amd64_ssse3:
;;; Binary Data
*/
+.rodata
.align 16
/* Mask for byte-swapping a couple of qwords in an XMM register using (v)pshufb. */

View File

@ -0,0 +1,20 @@
Index: cipher/sm4-aesni-avx-amd64.S
--- cipher/sm4-aesni-avx-amd64.S.orig
+++ cipher/sm4-aesni-avx-amd64.S
@@ -97,7 +97,7 @@
4-way && 8-way SM4 with AES-NI and AVX
**********************************************************************/
-.text
+.rodata
.align 16
/*
@@ -152,6 +152,7 @@
.L0f0f0f0f:
.long 0x0f0f0f0f
+.text
.align 8
.globl _gcry_sm4_aesni_avx_expand_key
ELF(.type _gcry_sm4_aesni_avx_expand_key,@function;)

View File

@ -0,0 +1,11 @@
Index: cipher/twofish-avx2-amd64.S
--- cipher/twofish-avx2-amd64.S.orig
+++ cipher/twofish-avx2-amd64.S
@@ -1036,6 +1036,7 @@ _gcry_twofish_avx2_ocb_auth:
CFI_ENDPROC();
ELF(.size _gcry_twofish_avx2_ocb_auth,.-_gcry_twofish_avx2_ocb_auth;)
+.rodata
.align 16
/* For CTR-mode IV byteswap */