[gnutls-devel] Patch: AES-NI not used for GCM on 32bit x86

Tim Kosse tim.kosse at filezilla-project.org
Sat Feb 14 16:31:47 CET 2015


GnuTLS has the assembly code to accelerate AES-GCM using the AES-NI
instruction set on both IA-32 and x86-64. In contrast, support for
PCLMUL with AES-GCM is only implemented for x86-64.

There's a misplaced #ifdef ASM_X86_64 in
lib/accelerated/x86/x86-common.c around the check for pclmul,
effectively disabling AES-NI for AES-GCM on IA-32 builds.

The attached patch (tested against 3.3.12) moves the else block out of
the #ifdef so that AES-NI is used to accelerate AES-GCM on IA-32 builds.

Using this patch I get around 15%-20% higher throughput when using the
AES-256-GCM cipher.

Tim Kosse
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gcm_aesni.patch
Type: text/x-patch
Size: 401 bytes
Desc: not available
URL: </pipermail/attachments/20150214/7cd4445f/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 196 bytes
Desc: OpenPGP digital signature
URL: </pipermail/attachments/20150214/7cd4445f/attachment.sig>

More information about the Gnutls-devel mailing list