Skip to content

Commit 1b8867f

Browse files
committed
Adapt BoringSSL implementation to mirror existing AVX assembly file
Signed-off-by: Joel Low <[email protected]>
1 parent 4c7cfaf commit 1b8867f

File tree

1 file changed

+24
-6
lines changed

1 file changed

+24
-6
lines changed

module/icp/asm-x86_64/modes/aesni-gcm-avx2.S

+24-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
11
// This file is generated from a similarly-named Perl script in the BoringSSL
22
// source tree. Do not edit by hand.
33

4-
#include <openssl/asm_base.h>
4+
#if defined(__x86_64__) && defined(HAVE_AVX) && \
5+
defined(HAVE_VAES) && defined(HAVE_VPCLMULQDQ)
6+
7+
#define _ASM
8+
#include <sys/asm_linkage.h>
9+
10+
/* Windows userland links with OpenSSL */
11+
#if !defined (_WIN32) || defined (_KERNEL)
12+
13+
#ifndef _CET_ENDBR
14+
#define _CET_ENDBR
15+
#endif
516

6-
#if !defined(OPENSSL_NO_ASM) && defined(OPENSSL_X86_64) && defined(__ELF__)
717
.section .rodata
818
.align 16
919

@@ -381,8 +391,8 @@ _CET_ENDBR
381391

382392

383393

384-
movl 240(%rcx),%r10d
385-
leal -20(,%r10,4),%r10d
394+
movl 504-128(%rcx),%r10d // ICP has a larger offset for rounds.
395+
leal -16(,%r10,4),%r10d // ICP uses 10,12,14 not 9,11,13 for rounds.
386396

387397

388398

@@ -917,8 +927,8 @@ _CET_ENDBR
917927

918928

919929

920-
movl 240(%rcx),%r10d
921-
leal -20(,%r10,4),%r10d
930+
movl 504-128(%rcx),%r10d // ICP has a larger offset for rounds.
931+
leal -16(,%r10,4),%r10d // ICP uses 10,12,14 not 9,11,13 for rounds.
922932

923933

924934

@@ -1315,4 +1325,12 @@ _CET_ENDBR
13151325

13161326
.cfi_endproc
13171327
.size aes_gcm_dec_update_vaes_avx2, . - aes_gcm_dec_update_vaes_avx2
1328+
1329+
#endif /* !_WIN32 || _KERNEL */
1330+
1331+
/* Mark the stack non-executable. */
1332+
#if defined(__linux__) && defined(__ELF__)
1333+
.section .note.GNU-stack,"",%progbits
13181334
#endif
1335+
1336+
#endif /* defined(__x86_64__) && defined(HAVE_AVX) && defined(HAVE_AES) ... */

0 commit comments

Comments
 (0)