[gnutls-devel] GnuTLS | x86:add detection of instruction set on Zhaoxin CPU (!1335)

Read-only notification of GnuTLS library development activities gnutls-devel at lists.gnutls.org
Fri Mar 5 13:06:36 CET 2021




Daiki Ueno started a new discussion on lib/accelerated/x86/x86-common.c: https://gitlab.com/gnutls/gnutls/-/merge_requests/1335#note_523016428

>  }
>  
>  /* We are actually checking for SHA512 */
>  static int check_phe_sha512(unsigned edx)
>  {
> -	return ((edx & via_bit_PADLOCK_PHE_SHA512) == via_bit_PADLOCK_PHE_SHA512);
> +	return ((edx & bit_PADLOCK_PHE_SHA512) == bit_PADLOCK_PHE_SHA512);
> +}
> +
> +/* On some of the Zhaoxin CPUs, pclmul has a faster acceleration effect */
> +static int check_fast_pclmul(void)
> +{
> +	unsigned int a,b,c,d;
> +	unsigned int family,model;
> +
> +	if (__get_cpuid(1, &a, &b, &c, &d))

@zzjianhui sorry, I failed to spot this during the review, but shouldn't this condition be `!__getcpuid(...)`? We have `#define __getcpuid(...) 0` as a fallback, and in that case GCC reports:
```console
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;
      |               ^

```

-- 
Reply to this email directly or view it on GitLab: https://gitlab.com/gnutls/gnutls/-/merge_requests/1335#note_523016428
You're receiving this email because of your account on gitlab.com.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gnupg.org/pipermail/gnutls-devel/attachments/20210305/face718d/attachment.html>


More information about the Gnutls-devel mailing list