From 7c77726799b375cc3f5a1e5c54bf0d045337f36e Mon Sep 17 00:00:00 2001 From: Daiki Ueno Date: Mon, 19 Sep 2022 07:40:01 +0900 Subject: accelerated: avoid symbol export mismatch with _gnutls_x86_cpuid_s If the LD doesn't have support for version scripts, _gnutls_x86_cpuid_s is exported through libtool's --export-symbols-regex and that causes link error with clang: libtool: link: nmedit -s .libs/libgnutls-symbols.expsym .libs/libgnutls.30.dylib /Library/Developer/CommandLineTools/usr/bin/nmedit: error: symbols names listed in: .libs/libgnutls-symbols.expsym not in: /opt/local/var/macports/build/_Users_marius_Development_MacPorts_ports_devel_gnutls/gnutls-devel/work/gnutls-3.7.5/lib/.libs/libgnutls.30.dylib __gnutls_x86_cpuid_s make[4]: *** [libgnutls.la] Error 1 This patch renames _gnutls_x86_cpuid_s to GNUTLS_x86_cpuid_s to avoid the issue. Problem investigated and fix suggested by Clemens Lang in: https://gitlab.com/gnutls/gnutls/-/issues/1370#note_967832583 Signed-off-by: Daiki Ueno --- cfg.mk | 8 ++-- lib/accelerated/x86/coff/aesni-x86.s | 4 +- lib/accelerated/x86/coff/aesni-x86_64.s | 6 +-- lib/accelerated/x86/coff/ghash-x86_64.s | 2 +- lib/accelerated/x86/coff/sha1-ssse3-x86_64.s | 6 +-- lib/accelerated/x86/coff/sha256-ssse3-x86_64.s | 2 +- lib/accelerated/x86/coff/sha512-ssse3-x86_64.s | 2 +- lib/accelerated/x86/elf/aesni-x86.s | 4 +- lib/accelerated/x86/elf/aesni-x86_64.s | 6 +-- lib/accelerated/x86/elf/ghash-x86_64.s | 2 +- lib/accelerated/x86/elf/sha1-ssse3-x86_64.s | 6 +-- lib/accelerated/x86/elf/sha256-ssse3-x86_64.s | 2 +- lib/accelerated/x86/elf/sha512-ssse3-x86_64.s | 2 +- lib/accelerated/x86/macosx/aesni-x86.s | 8 ++-- lib/accelerated/x86/macosx/aesni-x86_64.s | 6 +-- lib/accelerated/x86/macosx/ghash-x86_64.s | 2 +- lib/accelerated/x86/macosx/sha1-ssse3-x86_64.s | 6 +-- lib/accelerated/x86/macosx/sha256-ssse3-x86_64.s | 2 +- lib/accelerated/x86/macosx/sha512-ssse3-x86_64.s | 2 +- lib/accelerated/x86/x86-common.c | 48 ++++++++++++------------ 20 files changed, 63 insertions(+), 63 deletions(-) diff --git a/cfg.mk b/cfg.mk index cfd835f303..a135b66f72 100644 --- a/cfg.mk +++ b/cfg.mk @@ -212,7 +212,7 @@ lib/accelerated/x86/elf/%.s: devel/perlasm/%.pl .submodule.stamp cat $<.license $@.tmp > $@ && rm -f $@.tmp echo "" >> $@ echo ".section .note.GNU-stack,\"\",%progbits" >> $@ - sed -i 's/OPENSSL_ia32cap_P/_gnutls_x86_cpuid_s/g' $@ + sed -i 's/OPENSSL_ia32cap_P/GNUTLS_x86_cpuid_s/g' $@ lib/accelerated/x86/coff/%-x86.s: devel/perlasm/%-x86.pl .submodule.stamp CC=gcc perl $< coff \ @@ -220,7 +220,7 @@ lib/accelerated/x86/coff/%-x86.s: devel/perlasm/%-x86.pl .submodule.stamp $@.tmp cat $<.license $@.tmp > $@ && rm -f $@.tmp echo "" >> $@ - sed -i 's/OPENSSL_ia32cap_P/_gnutls_x86_cpuid_s/g' $@ + sed -i 's/OPENSSL_ia32cap_P/GNUTLS_x86_cpuid_s/g' $@ lib/accelerated/x86/coff/%-x86_64.s: devel/perlasm/%-x86_64.pl .submodule.stamp CC=gcc perl $< mingw64 \ @@ -228,7 +228,7 @@ lib/accelerated/x86/coff/%-x86_64.s: devel/perlasm/%-x86_64.pl .submodule.stamp $@.tmp cat $<.license $@.tmp > $@ && rm -f $@.tmp echo "" >> $@ - sed -i 's/OPENSSL_ia32cap_P/_gnutls_x86_cpuid_s/g' $@ + sed -i 's/OPENSSL_ia32cap_P/GNUTLS_x86_cpuid_s/g' $@ lib/accelerated/x86/macosx/%.s: devel/perlasm/%.pl .submodule.stamp CC=gcc perl $< macosx \ @@ -236,7 +236,7 @@ lib/accelerated/x86/macosx/%.s: devel/perlasm/%.pl .submodule.stamp $@.tmp cat $<.license $@.tmp > $@ && rm -f $@.tmp echo "" >> $@ - sed -i 's/OPENSSL_ia32cap_P/_gnutls_x86_cpuid_s/g' $@ + sed -i 's/OPENSSL_ia32cap_P/GNUTLS_x86_cpuid_s/g' $@ lib/accelerated/aarch64/elf/%.s: devel/perlasm/%.pl .submodule.stamp rm -f $@tmp diff --git a/lib/accelerated/x86/coff/aesni-x86.s b/lib/accelerated/x86/coff/aesni-x86.s index c6aa1a1e2a..92e5431f19 100644 --- a/lib/accelerated/x86/coff/aesni-x86.s +++ b/lib/accelerated/x86/coff/aesni-x86.s @@ -2873,7 +2873,7 @@ __aesni_set_encrypt_key: .L112pic: popl %ebx leal .Lkey_const-.L112pic(%ebx),%ebx - leal __gnutls_x86_cpuid_s,%ebp + leal _GNUTLS_x86_cpuid_s,%ebp movups (%eax),%xmm0 xorps %xmm4,%xmm4 movl 4(%ebp),%ebp @@ -3251,5 +3251,5 @@ _aesni_set_decrypt_key: .byte 83,45,78,73,44,32,67,82,89,80,84,79,71,65,77,83 .byte 32,98,121,32,60,97,112,112,114,111,64,111,112,101,110,115 .byte 115,108,46,111,114,103,62,0 -.comm __gnutls_x86_cpuid_s,16 +.comm _GNUTLS_x86_cpuid_s,16 diff --git a/lib/accelerated/x86/coff/aesni-x86_64.s b/lib/accelerated/x86/coff/aesni-x86_64.s index 3a07713e4e..0094f596c1 100644 --- a/lib/accelerated/x86/coff/aesni-x86_64.s +++ b/lib/accelerated/x86/coff/aesni-x86_64.s @@ -1258,7 +1258,7 @@ aesni_ctr32_encrypt_blocks: leaq 7(%r8),%r9 movl %r10d,96+12(%rsp) bswapl %r9d - movl _gnutls_x86_cpuid_s+4(%rip),%r10d + movl GNUTLS_x86_cpuid_s+4(%rip),%r10d xorl %ebp,%r9d andl $71303168,%r10d movl %r9d,112+12(%rsp) @@ -3869,7 +3869,7 @@ aesni_cbc_encrypt: movdqa %xmm5,%xmm14 movdqu 80(%rdi),%xmm7 movdqa %xmm6,%xmm15 - movl _gnutls_x86_cpuid_s+4(%rip),%r9d + movl GNUTLS_x86_cpuid_s+4(%rip),%r9d cmpq $0x70,%rdx jbe .Lcbc_dec_six_or_seven @@ -4418,7 +4418,7 @@ __aesni_set_encrypt_key: movl $268437504,%r10d movups (%rcx),%xmm0 xorps %xmm4,%xmm4 - andl _gnutls_x86_cpuid_s+4(%rip),%r10d + andl GNUTLS_x86_cpuid_s+4(%rip),%r10d leaq 16(%r8),%rax cmpl $256,%edx je .L14rounds diff --git a/lib/accelerated/x86/coff/ghash-x86_64.s b/lib/accelerated/x86/coff/ghash-x86_64.s index de207e4002..82634dfa0a 100644 --- a/lib/accelerated/x86/coff/ghash-x86_64.s +++ b/lib/accelerated/x86/coff/ghash-x86_64.s @@ -997,7 +997,7 @@ gcm_ghash_clmul: jz .Lodd_tail movdqu 16(%rdx),%xmm6 - movl _gnutls_x86_cpuid_s+4(%rip),%eax + movl GNUTLS_x86_cpuid_s+4(%rip),%eax cmpq $0x30,%r9 jb .Lskip4x diff --git a/lib/accelerated/x86/coff/sha1-ssse3-x86_64.s b/lib/accelerated/x86/coff/sha1-ssse3-x86_64.s index 79f841f1ac..eb7924d077 100644 --- a/lib/accelerated/x86/coff/sha1-ssse3-x86_64.s +++ b/lib/accelerated/x86/coff/sha1-ssse3-x86_64.s @@ -53,9 +53,9 @@ sha1_block_data_order: movq %r8,%rdx - movl _gnutls_x86_cpuid_s+0(%rip),%r9d - movl _gnutls_x86_cpuid_s+4(%rip),%r8d - movl _gnutls_x86_cpuid_s+8(%rip),%r10d + movl GNUTLS_x86_cpuid_s+0(%rip),%r9d + movl GNUTLS_x86_cpuid_s+4(%rip),%r8d + movl GNUTLS_x86_cpuid_s+8(%rip),%r10d testl $512,%r8d jz .Lialu testl $536870912,%r10d diff --git a/lib/accelerated/x86/coff/sha256-ssse3-x86_64.s b/lib/accelerated/x86/coff/sha256-ssse3-x86_64.s index 78fae2a623..389cac9342 100644 --- a/lib/accelerated/x86/coff/sha256-ssse3-x86_64.s +++ b/lib/accelerated/x86/coff/sha256-ssse3-x86_64.s @@ -53,7 +53,7 @@ sha256_block_data_order: movq %r8,%rdx - leaq _gnutls_x86_cpuid_s(%rip),%r11 + leaq GNUTLS_x86_cpuid_s(%rip),%r11 movl 0(%r11),%r9d movl 4(%r11),%r10d movl 8(%r11),%r11d diff --git a/lib/accelerated/x86/coff/sha512-ssse3-x86_64.s b/lib/accelerated/x86/coff/sha512-ssse3-x86_64.s index 836e0cf66e..8065de24c2 100644 --- a/lib/accelerated/x86/coff/sha512-ssse3-x86_64.s +++ b/lib/accelerated/x86/coff/sha512-ssse3-x86_64.s @@ -53,7 +53,7 @@ sha512_block_data_order: movq %r8,%rdx - leaq _gnutls_x86_cpuid_s(%rip),%r11 + leaq GNUTLS_x86_cpuid_s(%rip),%r11 movl 0(%r11),%r9d movl 4(%r11),%r10d movl 8(%r11),%r11d diff --git a/lib/accelerated/x86/elf/aesni-x86.s b/lib/accelerated/x86/elf/aesni-x86.s index 6e4860209f..0c13b39353 100644 --- a/lib/accelerated/x86/elf/aesni-x86.s +++ b/lib/accelerated/x86/elf/aesni-x86.s @@ -2892,7 +2892,7 @@ _aesni_set_encrypt_key: .L112pic: popl %ebx leal .Lkey_const-.L112pic(%ebx),%ebx - leal _gnutls_x86_cpuid_s-.Lkey_const(%ebx),%ebp + leal GNUTLS_x86_cpuid_s-.Lkey_const(%ebx),%ebp movups (%eax),%xmm0 xorps %xmm4,%xmm4 movl 4(%ebp),%ebp @@ -3273,6 +3273,6 @@ aesni_set_decrypt_key: .byte 83,45,78,73,44,32,67,82,89,80,84,79,71,65,77,83 .byte 32,98,121,32,60,97,112,112,114,111,64,111,112,101,110,115 .byte 115,108,46,111,114,103,62,0 -.comm _gnutls_x86_cpuid_s,16,4 +.comm GNUTLS_x86_cpuid_s,16,4 .section .note.GNU-stack,"",%progbits diff --git a/lib/accelerated/x86/elf/aesni-x86_64.s b/lib/accelerated/x86/elf/aesni-x86_64.s index acc7c2c555..b8441980d6 100644 --- a/lib/accelerated/x86/elf/aesni-x86_64.s +++ b/lib/accelerated/x86/elf/aesni-x86_64.s @@ -1151,7 +1151,7 @@ aesni_ctr32_encrypt_blocks: leaq 7(%r8),%r9 movl %r10d,96+12(%rsp) bswapl %r9d - movl _gnutls_x86_cpuid_s+4(%rip),%r10d + movl GNUTLS_x86_cpuid_s+4(%rip),%r10d xorl %ebp,%r9d andl $71303168,%r10d movl %r9d,112+12(%rsp) @@ -3600,7 +3600,7 @@ aesni_cbc_encrypt: movdqa %xmm5,%xmm14 movdqu 80(%rdi),%xmm7 movdqa %xmm6,%xmm15 - movl _gnutls_x86_cpuid_s+4(%rip),%r9d + movl GNUTLS_x86_cpuid_s+4(%rip),%r9d cmpq $0x70,%rdx jbe .Lcbc_dec_six_or_seven @@ -4131,7 +4131,7 @@ __aesni_set_encrypt_key: movl $268437504,%r10d movups (%rdi),%xmm0 xorps %xmm4,%xmm4 - andl _gnutls_x86_cpuid_s+4(%rip),%r10d + andl GNUTLS_x86_cpuid_s+4(%rip),%r10d leaq 16(%rdx),%rax cmpl $256,%esi je .L14rounds diff --git a/lib/accelerated/x86/elf/ghash-x86_64.s b/lib/accelerated/x86/elf/ghash-x86_64.s index 1e4d18b341..856ff179db 100644 --- a/lib/accelerated/x86/elf/ghash-x86_64.s +++ b/lib/accelerated/x86/elf/ghash-x86_64.s @@ -968,7 +968,7 @@ gcm_ghash_clmul: jz .Lodd_tail movdqu 16(%rsi),%xmm6 - movl _gnutls_x86_cpuid_s+4(%rip),%eax + movl GNUTLS_x86_cpuid_s+4(%rip),%eax cmpq $0x30,%rcx jb .Lskip4x diff --git a/lib/accelerated/x86/elf/sha1-ssse3-x86_64.s b/lib/accelerated/x86/elf/sha1-ssse3-x86_64.s index d34f34497c..d85d9ff21b 100644 --- a/lib/accelerated/x86/elf/sha1-ssse3-x86_64.s +++ b/lib/accelerated/x86/elf/sha1-ssse3-x86_64.s @@ -45,9 +45,9 @@ .align 16 sha1_block_data_order: .cfi_startproc - movl _gnutls_x86_cpuid_s+0(%rip),%r9d - movl _gnutls_x86_cpuid_s+4(%rip),%r8d - movl _gnutls_x86_cpuid_s+8(%rip),%r10d + movl GNUTLS_x86_cpuid_s+0(%rip),%r9d + movl GNUTLS_x86_cpuid_s+4(%rip),%r8d + movl GNUTLS_x86_cpuid_s+8(%rip),%r10d testl $512,%r8d jz .Lialu testl $536870912,%r10d diff --git a/lib/accelerated/x86/elf/sha256-ssse3-x86_64.s b/lib/accelerated/x86/elf/sha256-ssse3-x86_64.s index d196c6a793..874062e0df 100644 --- a/lib/accelerated/x86/elf/sha256-ssse3-x86_64.s +++ b/lib/accelerated/x86/elf/sha256-ssse3-x86_64.s @@ -45,7 +45,7 @@ .align 16 sha256_block_data_order: .cfi_startproc - leaq _gnutls_x86_cpuid_s(%rip),%r11 + leaq GNUTLS_x86_cpuid_s(%rip),%r11 movl 0(%r11),%r9d movl 4(%r11),%r10d movl 8(%r11),%r11d diff --git a/lib/accelerated/x86/elf/sha512-ssse3-x86_64.s b/lib/accelerated/x86/elf/sha512-ssse3-x86_64.s index 446c06a3e6..039b1d7dd2 100644 --- a/lib/accelerated/x86/elf/sha512-ssse3-x86_64.s +++ b/lib/accelerated/x86/elf/sha512-ssse3-x86_64.s @@ -45,7 +45,7 @@ .align 16 sha512_block_data_order: .cfi_startproc - leaq _gnutls_x86_cpuid_s(%rip),%r11 + leaq GNUTLS_x86_cpuid_s(%rip),%r11 movl 0(%r11),%r9d movl 4(%r11),%r10d movl 8(%r11),%r11d diff --git a/lib/accelerated/x86/macosx/aesni-x86.s b/lib/accelerated/x86/macosx/aesni-x86.s index ee50089146..774d1f4a01 100644 --- a/lib/accelerated/x86/macosx/aesni-x86.s +++ b/lib/accelerated/x86/macosx/aesni-x86.s @@ -2853,7 +2853,7 @@ __aesni_set_encrypt_key: L112pic: popl %ebx leal Lkey_const-L112pic(%ebx),%ebx - movl L__gnutls_x86_cpuid_s$non_lazy_ptr-Lkey_const(%ebx),%ebp + movl L_GNUTLS_x86_cpuid_s$non_lazy_ptr-Lkey_const(%ebx),%ebp movups (%eax),%xmm0 xorps %xmm4,%xmm4 movl 4(%ebp),%ebp @@ -3230,8 +3230,8 @@ Lkey_const: .byte 32,98,121,32,60,97,112,112,114,111,64,111,112,101,110,115 .byte 115,108,46,111,114,103,62,0 .section __IMPORT,__pointers,non_lazy_symbol_pointers -L__gnutls_x86_cpuid_s$non_lazy_ptr: -.indirect_symbol __gnutls_x86_cpuid_s +L_GNUTLS_x86_cpuid_s$non_lazy_ptr: +.indirect_symbol _GNUTLS_x86_cpuid_s .long 0 -.comm __gnutls_x86_cpuid_s,16,2 +.comm _GNUTLS_x86_cpuid_s,16,2 diff --git a/lib/accelerated/x86/macosx/aesni-x86_64.s b/lib/accelerated/x86/macosx/aesni-x86_64.s index 3601d54386..afb7aeac9f 100644 --- a/lib/accelerated/x86/macosx/aesni-x86_64.s +++ b/lib/accelerated/x86/macosx/aesni-x86_64.s @@ -1151,7 +1151,7 @@ L$ctr32_bulk: leaq 7(%r8),%r9 movl %r10d,96+12(%rsp) bswapl %r9d - movl __gnutls_x86_cpuid_s+4(%rip),%r10d + movl _GNUTLS_x86_cpuid_s+4(%rip),%r10d xorl %ebp,%r9d andl $71303168,%r10d movl %r9d,112+12(%rsp) @@ -3590,7 +3590,7 @@ L$cbc_decrypt_bulk: movdqa %xmm5,%xmm14 movdqu 80(%rdi),%xmm7 movdqa %xmm6,%xmm15 - movl __gnutls_x86_cpuid_s+4(%rip),%r9d + movl _GNUTLS_x86_cpuid_s+4(%rip),%r9d cmpq $0x70,%rdx jbe L$cbc_dec_six_or_seven @@ -4121,7 +4121,7 @@ __aesni_set_encrypt_key: movl $268437504,%r10d movups (%rdi),%xmm0 xorps %xmm4,%xmm4 - andl __gnutls_x86_cpuid_s+4(%rip),%r10d + andl _GNUTLS_x86_cpuid_s+4(%rip),%r10d leaq 16(%rdx),%rax cmpl $256,%esi je L$14rounds diff --git a/lib/accelerated/x86/macosx/ghash-x86_64.s b/lib/accelerated/x86/macosx/ghash-x86_64.s index 5fd3216755..a715212393 100644 --- a/lib/accelerated/x86/macosx/ghash-x86_64.s +++ b/lib/accelerated/x86/macosx/ghash-x86_64.s @@ -956,7 +956,7 @@ L$_ghash_clmul: jz L$odd_tail movdqu 16(%rsi),%xmm6 - movl __gnutls_x86_cpuid_s+4(%rip),%eax + movl _GNUTLS_x86_cpuid_s+4(%rip),%eax cmpq $0x30,%rcx jb L$skip4x diff --git a/lib/accelerated/x86/macosx/sha1-ssse3-x86_64.s b/lib/accelerated/x86/macosx/sha1-ssse3-x86_64.s index 7b5d9dfc9e..f326c34e60 100644 --- a/lib/accelerated/x86/macosx/sha1-ssse3-x86_64.s +++ b/lib/accelerated/x86/macosx/sha1-ssse3-x86_64.s @@ -45,9 +45,9 @@ .p2align 4 _sha1_block_data_order: - movl __gnutls_x86_cpuid_s+0(%rip),%r9d - movl __gnutls_x86_cpuid_s+4(%rip),%r8d - movl __gnutls_x86_cpuid_s+8(%rip),%r10d + movl _GNUTLS_x86_cpuid_s+0(%rip),%r9d + movl _GNUTLS_x86_cpuid_s+4(%rip),%r8d + movl _GNUTLS_x86_cpuid_s+8(%rip),%r10d testl $512,%r8d jz L$ialu testl $536870912,%r10d diff --git a/lib/accelerated/x86/macosx/sha256-ssse3-x86_64.s b/lib/accelerated/x86/macosx/sha256-ssse3-x86_64.s index 9fed36b9c8..1312ef49ec 100644 --- a/lib/accelerated/x86/macosx/sha256-ssse3-x86_64.s +++ b/lib/accelerated/x86/macosx/sha256-ssse3-x86_64.s @@ -45,7 +45,7 @@ .p2align 4 _sha256_block_data_order: - leaq __gnutls_x86_cpuid_s(%rip),%r11 + leaq _GNUTLS_x86_cpuid_s(%rip),%r11 movl 0(%r11),%r9d movl 4(%r11),%r10d movl 8(%r11),%r11d diff --git a/lib/accelerated/x86/macosx/sha512-ssse3-x86_64.s b/lib/accelerated/x86/macosx/sha512-ssse3-x86_64.s index e78d90f2d3..6e52aaaaa7 100644 --- a/lib/accelerated/x86/macosx/sha512-ssse3-x86_64.s +++ b/lib/accelerated/x86/macosx/sha512-ssse3-x86_64.s @@ -45,7 +45,7 @@ .p2align 4 _sha512_block_data_order: - leaq __gnutls_x86_cpuid_s(%rip),%r11 + leaq _GNUTLS_x86_cpuid_s(%rip),%r11 movl 0(%r11),%r9d movl 4(%r11),%r10d movl 8(%r11),%r11d diff --git a/lib/accelerated/x86/x86-common.c b/lib/accelerated/x86/x86-common.c index b7a88ddeca..d1a76c9d90 100644 --- a/lib/accelerated/x86/x86-common.c +++ b/lib/accelerated/x86/x86-common.c @@ -53,7 +53,7 @@ __attribute__((visibility("hidden"))) #elif defined(__SUNPRO_C) __hidden #endif -unsigned int _gnutls_x86_cpuid_s[4]; +unsigned int GNUTLS_x86_cpuid_s[4]; #ifndef bit_SHA # define bit_SHA (1<<29) @@ -189,7 +189,7 @@ static void capabilities_to_intel_cpuid(unsigned capabilities) if (capabilities & INTEL_AES_NI) { if (a[1] & bit_AES) { - _gnutls_x86_cpuid_s[1] |= bit_AES; + GNUTLS_x86_cpuid_s[1] |= bit_AES; } else { _gnutls_debug_log ("AESNI acceleration requested but not available\n"); @@ -198,7 +198,7 @@ static void capabilities_to_intel_cpuid(unsigned capabilities) if (capabilities & INTEL_SSSE3) { if (a[1] & bit_SSSE3) { - _gnutls_x86_cpuid_s[1] |= bit_SSSE3; + GNUTLS_x86_cpuid_s[1] |= bit_SSSE3; } else { _gnutls_debug_log ("SSSE3 acceleration requested but not available\n"); @@ -208,7 +208,7 @@ static void capabilities_to_intel_cpuid(unsigned capabilities) if (capabilities & INTEL_AVX) { if ((a[1] & bit_AVX) && (a[1] & bit_MOVBE) && check_4th_gen_intel_features(a[1])) { - _gnutls_x86_cpuid_s[1] |= bit_AVX|bit_MOVBE; + GNUTLS_x86_cpuid_s[1] |= bit_AVX|bit_MOVBE; } else { _gnutls_debug_log ("AVX acceleration requested but not available\n"); @@ -217,7 +217,7 @@ static void capabilities_to_intel_cpuid(unsigned capabilities) if (capabilities & INTEL_PCLMUL) { if (a[1] & bit_PCLMUL) { - _gnutls_x86_cpuid_s[1] |= bit_PCLMUL; + GNUTLS_x86_cpuid_s[1] |= bit_PCLMUL; } else { _gnutls_debug_log ("PCLMUL acceleration requested but not available\n"); @@ -226,7 +226,7 @@ static void capabilities_to_intel_cpuid(unsigned capabilities) if (capabilities & INTEL_SHA) { if (a[2] & bit_SHA) { - _gnutls_x86_cpuid_s[2] |= bit_SHA; + GNUTLS_x86_cpuid_s[2] |= bit_SHA; } else { _gnutls_debug_log ("SHA acceleration requested but not available\n"); @@ -237,28 +237,28 @@ static void capabilities_to_intel_cpuid(unsigned capabilities) static unsigned check_optimized_aes(void) { - return (_gnutls_x86_cpuid_s[1] & bit_AES); + return (GNUTLS_x86_cpuid_s[1] & bit_AES); } static unsigned check_ssse3(void) { - return (_gnutls_x86_cpuid_s[1] & bit_SSSE3); + return (GNUTLS_x86_cpuid_s[1] & bit_SSSE3); } static unsigned check_sha(void) { - return (_gnutls_x86_cpuid_s[2] & bit_SHA); + return (GNUTLS_x86_cpuid_s[2] & bit_SHA); } #ifdef ASM_X86_64 static unsigned check_avx_movbe(void) { - return (_gnutls_x86_cpuid_s[1] & (bit_AVX|bit_MOVBE)) == (bit_AVX|bit_MOVBE); + return (GNUTLS_x86_cpuid_s[1] & (bit_AVX|bit_MOVBE)) == (bit_AVX|bit_MOVBE); } static unsigned check_pclmul(void) { - return (_gnutls_x86_cpuid_s[1] & bit_PCLMUL); + return (GNUTLS_x86_cpuid_s[1] & bit_PCLMUL); } #endif @@ -275,7 +275,7 @@ static unsigned capabilities_to_zhaoxin_edx(unsigned capabilities) return 0; if (capabilities & PADLOCK) { if (c & bit_PADLOCK) { - _gnutls_x86_cpuid_s[2] |= bit_PADLOCK; + GNUTLS_x86_cpuid_s[2] |= bit_PADLOCK; } else { _gnutls_debug_log ("Padlock acceleration requested but not available\n"); @@ -284,7 +284,7 @@ static unsigned capabilities_to_zhaoxin_edx(unsigned capabilities) if (capabilities & PADLOCK_PHE) { if (c & bit_PADLOCK_PHE) { - _gnutls_x86_cpuid_s[2] |= bit_PADLOCK_PHE; + GNUTLS_x86_cpuid_s[2] |= bit_PADLOCK_PHE; } else { _gnutls_debug_log ("Padlock-PHE acceleration requested but not available\n"); @@ -293,14 +293,14 @@ static unsigned capabilities_to_zhaoxin_edx(unsigned capabilities) if (capabilities & PADLOCK_PHE_SHA512) { if (c & bit_PADLOCK_PHE_SHA512) { - _gnutls_x86_cpuid_s[2] |= bit_PADLOCK_PHE_SHA512; + GNUTLS_x86_cpuid_s[2] |= bit_PADLOCK_PHE_SHA512; } else { _gnutls_debug_log ("Padlock-PHE-SHA512 acceleration requested but not available\n"); } } - return _gnutls_x86_cpuid_s[2]; + return GNUTLS_x86_cpuid_s[2]; } static int check_padlock(unsigned edx) @@ -388,10 +388,10 @@ void register_x86_padlock_crypto(unsigned capabilities) if (check_zhaoxin() == 0) return; - memset(_gnutls_x86_cpuid_s, 0, sizeof(_gnutls_x86_cpuid_s)); + memset(GNUTLS_x86_cpuid_s, 0, sizeof(GNUTLS_x86_cpuid_s)); if (capabilities == 0){ - if(!read_cpuid_vals(_gnutls_x86_cpuid_s)) + if(!read_cpuid_vals(GNUTLS_x86_cpuid_s)) return; edx = padlock_capability(); } else{ @@ -888,7 +888,7 @@ void register_x86_intel_crypto(unsigned capabilities) int ret; enum x86_cpu_vendor vendor; - memset(_gnutls_x86_cpuid_s, 0, sizeof(_gnutls_x86_cpuid_s)); + memset(GNUTLS_x86_cpuid_s, 0, sizeof(GNUTLS_x86_cpuid_s)); vendor = check_x86_cpu_vendor(); if (vendor == X86_CPU_VENDOR_OTHER) { @@ -896,16 +896,16 @@ void register_x86_intel_crypto(unsigned capabilities) } if (capabilities == 0) { - if (!read_cpuid_vals(_gnutls_x86_cpuid_s)) + if (!read_cpuid_vals(GNUTLS_x86_cpuid_s)) return; - if (!check_4th_gen_intel_features(_gnutls_x86_cpuid_s[1])) { - _gnutls_x86_cpuid_s[1] &= ~bit_AVX; + if (!check_4th_gen_intel_features(GNUTLS_x86_cpuid_s[1])) { + GNUTLS_x86_cpuid_s[1] &= ~bit_AVX; /* Clear AVX2 bits as well, according to what * OpenSSL does. Should we clear * bit_AVX512DQ, bit_AVX512PF, bit_AVX512ER, * and bit_AVX512CD? */ - _gnutls_x86_cpuid_s[2] &= ~(bit_AVX2| + GNUTLS_x86_cpuid_s[2] &= ~(bit_AVX2| bit_AVX512F| bit_AVX512IFMA| bit_AVX512BW| @@ -917,9 +917,9 @@ void register_x86_intel_crypto(unsigned capabilities) /* CRYPTOGAMS uses the (1 << 30) bit as an indicator of Intel CPUs */ if (vendor == X86_CPU_VENDOR_INTEL) { - _gnutls_x86_cpuid_s[0] |= 1 << 30; + GNUTLS_x86_cpuid_s[0] |= 1 << 30; } else { - _gnutls_x86_cpuid_s[0] &= ~(1 << 30); + GNUTLS_x86_cpuid_s[0] &= ~(1 << 30); } if (check_ssse3()) { -- cgit v1.2.1