From 83ac883f8c05f4bde916e4f4d69b6d6645a0b174 Mon Sep 17 00:00:00 2001 From: Daiki Ueno Date: Tue, 9 Mar 2021 20:29:37 +0100 Subject: x86: flip polarity of check_fast_pclmul Otherwise GCC produces the following warnings as the stub __get_cpuid() is defined as '#define __get_cpuid(...) 0': x86-common.c: In function 'register_x86_crypto': x86-common.c:314:15: warning: 'a' may be used uninitialized in this function [-Wmaybe-uninitialized] 314 | family = ((a >> 8) & 0x0F); | ~~~^~~~~ x86-common.c:308:15: note: 'a' was declared here 308 | unsigned int a,b,c,d; | ^ Signed-off-by: Daiki Ueno --- lib/accelerated/x86/x86-common.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/accelerated/x86/x86-common.c b/lib/accelerated/x86/x86-common.c index ea4f0238b6..80d37f49d5 100644 --- a/lib/accelerated/x86/x86-common.c +++ b/lib/accelerated/x86/x86-common.c @@ -308,14 +308,14 @@ static int check_fast_pclmul(void) unsigned int a,b,c,d; unsigned int family,model; - if (__get_cpuid(1, &a, &b, &c, &d)) + if (!__get_cpuid(1, &a, &b, &c, &d)) return 0; family = ((a >> 8) & 0x0F); model = ((a >> 4) & 0x0F) + ((a >> 12) & 0xF0); - if(((family == 0x6) && (model == 0xf || model == 0x19)) || - ((family == 0x7) && (model == 0x1B || model == 0x3B))) + if (((family == 0x6) && (model == 0xf || model == 0x19)) || + ((family == 0x7) && (model == 0x1B || model == 0x3B))) return 1; else return 0; @@ -584,7 +584,7 @@ void register_x86_padlock_crypto(unsigned capabilities) /* register GCM ciphers */ _gnutls_debug_log ("Zhaoxin GCM accelerator was detected\n"); - if (check_avx_movbe() && !check_fast_pclmul()) { + if (check_avx_movbe() && check_fast_pclmul()) { _gnutls_debug_log ("Zhaoxin GCM accelerator (AVX) was detected\n"); ret = -- cgit v1.2.1