crypto: aesni - Add support for 192 & 256 bit keys to AESNI RFC4106
authorTimothy McCaffrey <timothy.mccaffrey@unisys.com>
Tue, 13 Jan 2015 18:16:43 +0000 (13:16 -0500)
committerHerbert Xu <herbert@gondor.apana.org.au>
Wed, 14 Jan 2015 10:56:51 +0000 (21:56 +1100)
commite31ac32d3bc27c33f002e0c9ffd6ae08b65474e6
treee2f11e810e52f8aa8a1b5e813a64ef56f1c1a6a6
parentd8219f52a72033f84c15cde73294d46578fb2d68
crypto: aesni - Add support for 192 & 256 bit keys to AESNI RFC4106

These patches fix the RFC4106 implementation in the aesni-intel
module so it supports 192 & 256 bit keys.

Since the AVX support that was added to this module also only
supports 128 bit keys, and this patch only affects the SSE
implementation, changes were also made to use the SSE version
if key sizes other than 128 are specified.

RFC4106 specifies that 192 & 256 bit keys must be supported (section
8.4).

Also, this should fix Strongswan issue 341 where the aesni module
needs to be unloaded if 256 bit keys are used:

http://wiki.strongswan.org/issues/341

This patch has been tested with Sandy Bridge and Haswell processors.
With 128 bit keys and input buffers > 512 bytes a slight performance
degradation was noticed (~1%).  For input buffers of less than 512
bytes there was no performance impact.  Compared to 128 bit keys,
256 bit key size performance is approx. .5 cycles per byte slower
on Sandy Bridge, and .37 cycles per byte slower on Haswell (vs.
SSE code).

This patch has also been tested with StrongSwan IPSec connections
where it worked correctly.

I created this diff from a git clone of crypto-2.6.git.

Any questions, please feel free to contact me.

Signed-off-by: Timothy McCaffrey <timothy.mccaffrey@unisys.com>
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
arch/x86/crypto/aesni-intel_asm.S
arch/x86/crypto/aesni-intel_glue.c