[gnutls-devel] GnuTLS | lib: add support for Hygon Genuine CPUs in x86 acceleration (!2053)

Read-only notification of GnuTLS library development activities gnutls-devel at lists.gnutls.org
Thu Jan 15 03:26:39 CET 2026



Merge request https://gitlab.com/gnutls/gnutls/-/merge_requests/2053 was reviewed by xinpeng wang

--
  
xinpeng wang commented on a discussion: https://gitlab.com/gnutls/gnutls/-/merge_requests/2053#note_3007000934


Hi Alexander, thanks for your feedback. Here is the elaboration on the hardware compatibility and the crash scenario:

1. Hardware Compatibility Evidence I’ve verified that Hygon CPUs are fully instruction-compatible with the paths enabled in register_x86_intel_crypto. Below is the raw output from a test program on a Hygon Dhyana processor mimicking GnuTLS's read_cpuid_vals():

Vendor ID: HygonGenuine

ECX (vals[1]): 0x7ed8320b → Bit 25 (AES-NI) is 1; Bit 9 (SSSE3) is 1.

EBX (vals[2]): 0x209c01a9 → Bit 29 (SHA-NI) is 1; Bit 5 (AVX2) is 1.

The lscpu flags also confirm the presence of aes, ssse3, pclmulqdq, and sha_ni. Once identified, the existing feature-detection logic works perfectly for Hygon.

2. Elaboration on the Crash (0xc0000094) The issue was observed while running Windows versions of Photoshop via Wine on Linux.

The Trigger: The application calls BCryptDecrypt for AES decryption.

The Failure: When Hygon is identified as VENDOR_OTHER, GnuTLS bypasses hardware acceleration and falls back to the generic Nettle wrapper.

Observation: IDA Pro analysis of the execution flow in this environment suggests that the generic software path triggers an Integer Divide-by-Zero (0xc0000094). 

The Fix: By enabling this patch, GnuTLS correctly initializes the _gnutls_aesni_x86 path. This uses hardware instructions directly, bypassing the problematic software division logic and resolving the crash.


-- 
Reply to this email directly or view it on GitLab: https://gitlab.com/gnutls/gnutls/-/merge_requests/2053
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/20260115/7704688f/attachment.html>


More information about the Gnutls-devel mailing list