chapoly: Add an SSSE3 based driver

We always build the driver on x86/x64, but enable it only if SSSE3 support
is detected during runtime.

Poly1305 uses parallel 32-bit multiplication operands yielding a 64-bit result,
for which two can be done in parallel in SSE. This is minimally faster than
multiplication with 64-bit operands, and also works on 32-bit builds not having
a __int128 result type.

On a 32-bit architecture, this is more than twice as fast as the portable
driver, and on 64-bit it is ~30% faster.
This commit is contained in:
Martin Willi
2015-06-29 17:32:14 +02:00
parent 42459b41f0
commit 755dadcfda
4 changed files with 514 additions and 1 deletions
+11 -1
View File
@@ -4,8 +4,9 @@ AM_CPPFLAGS = \
AM_CFLAGS = \
$(PLUGIN_CFLAGS)
noinst_LTLIBRARIES =
if MONOLITHIC
noinst_LTLIBRARIES = libstrongswan-chapoly.la
noinst_LTLIBRARIES += libstrongswan-chapoly.la
else
plugin_LTLIBRARIES = libstrongswan-chapoly.la
endif
@@ -16,4 +17,13 @@ libstrongswan_chapoly_la_SOURCES = \
chapoly_drv_portable.h chapoly_drv_portable.c \
chapoly_aead.h chapoly_aead.c
noinst_LTLIBRARIES += libchapoly-drv-ssse3.la
libchapoly_drv_ssse3_la_SOURCES = chapoly_drv_ssse3.h chapoly_drv_ssse3.c
if USE_X86X64
libchapoly_drv_ssse3_la_CFLAGS = $(PLUGIN_CFLAGS) -mssse3
endif
libstrongswan_chapoly_la_LIBADD = \
libchapoly-drv-ssse3.la
libstrongswan_chapoly_la_LDFLAGS = -module -avoid-version