linux/arch/x86/crypto
Mathias Krause 66be895158 crypto: sha1 - SSSE3 based SHA1 implementation for x86-64
This is an assembler implementation of the SHA1 algorithm using the
Supplemental SSE3 (SSSE3) instructions or, when available, the
Advanced Vector Extensions (AVX).

Testing with the tcrypt module shows the raw hash performance is up to
2.3 times faster than the C implementation, using 8k data blocks on a
Core 2 Duo T5500. For the smalest data set (16 byte) it is still 25%
faster.

Since this implementation uses SSE/YMM registers it cannot safely be
used in every situation, e.g. while an IRQ interrupts a kernel thread.
The implementation falls back to the generic SHA1 variant, if using
the SSE/YMM registers is not possible.

With this algorithm I was able to increase the throughput of a single
IPsec link from 344 Mbit/s to 464 Mbit/s on a Core 2 Quad CPU using
the SSSE3 variant -- a speedup of +34.8%.

Saving and restoring SSE/YMM state might make the actual throughput
fluctuate when there are FPU intensive userland applications running.
For example, meassuring the performance using iperf2 directly on the
machine under test gives wobbling numbers because iperf2 uses the FPU
for each packet to check if the reporting interval has expired (in the
above test I got min/max/avg: 402/484/464 MBit/s).

Using this algorithm on a IPsec gateway gives much more reasonable and
stable numbers, albeit not as high as in the directly connected case.
Here is the result from an RFC 2544 test run with a EXFO Packet Blazer
FTB-8510:

 frame size    sha1-generic     sha1-ssse3    delta
    64 byte     37.5 MBit/s    37.5 MBit/s     0.0%
   128 byte     56.3 MBit/s    62.5 MBit/s   +11.0%
   256 byte     87.5 MBit/s   100.0 MBit/s   +14.3%
   512 byte    131.3 MBit/s   150.0 MBit/s   +14.2%
  1024 byte    162.5 MBit/s   193.8 MBit/s   +19.3%
  1280 byte    175.0 MBit/s   212.5 MBit/s   +21.4%
  1420 byte    175.0 MBit/s   218.7 MBit/s   +25.0%
  1518 byte    150.0 MBit/s   181.2 MBit/s   +20.8%

The throughput for the largest frame size is lower than for the
previous size because the IP packets need to be fragmented in this
case to make there way through the IPsec tunnel.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
Cc: Maxim Locktyukhin <maxim.locktyukhin@intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2011-08-10 19:00:29 +08:00
..
aes_glue.c crypto: aes - Export x86 AES encrypt/decrypt functions 2009-02-18 16:48:05 +08:00
aes-i586-asm_32.S crypto: aes - Export x86 AES encrypt/decrypt functions 2009-02-18 16:48:05 +08:00
aes-x86_64-asm_64.S crypto: aes - Export x86 AES encrypt/decrypt functions 2009-02-18 16:48:05 +08:00
aesni-intel_asm.S crypto: aesni-intel - fixed problem with packets that are not multiple of 64bytes 2011-03-27 10:29:39 +08:00
aesni-intel_glue.c crypto: aesni-intel - fix aesni build on i386 2011-05-18 09:03:34 +10:00
crc32c-intel.c crypto: crc32c-intel - Switch to shash 2008-12-25 11:01:37 +11:00
fpu.c crypto: aesni-intel - Merge with fpu.ko 2011-05-16 15:12:47 +10:00
ghash-clmulni-intel_asm.S crypto: ghash-clmulni-intel - Put proper .data section in place 2009-11-23 20:19:47 +08:00
ghash-clmulni-intel_glue.c crypto: ghash-intel - Fix set but not used in ghash_async_setkey() 2011-06-30 07:43:42 +08:00
Makefile crypto: sha1 - SSSE3 based SHA1 implementation for x86-64 2011-08-10 19:00:29 +08:00
salsa20_glue.c [CRYPTO] salsa20: Add x86-64 assembly version 2008-01-11 08:16:57 +11:00
salsa20-i586-asm_32.S [CRYPTO] salsa20_i586: Salsa20 stream cipher algorithm (i586 version) 2008-01-11 08:16:57 +11:00
salsa20-x86_64-asm_64.S [CRYPTO] salsa20: Add x86-64 assembly version 2008-01-11 08:16:57 +11:00
sha1_ssse3_asm.S crypto: sha1 - SSSE3 based SHA1 implementation for x86-64 2011-08-10 19:00:29 +08:00
sha1_ssse3_glue.c crypto: sha1 - SSSE3 based SHA1 implementation for x86-64 2011-08-10 19:00:29 +08:00
twofish_glue.c [CRYPTO] twofish: Merge common glue code 2008-01-14 17:07:57 +11:00
twofish-i586-asm_32.S tree-wide: Assorted spelling fixes 2010-02-09 11:13:56 +01:00
twofish-x86_64-asm_64.S tree-wide: Assorted spelling fixes 2010-02-09 11:13:56 +01:00