Add carryless 8-bit addition fast-path for AES-NI CTR mode
authorJussi Kivilinna <jussi.kivilinna@iki.fi>
Mon, 10 Aug 2015 17:48:02 +0000 (20:48 +0300)
committerJussi Kivilinna <jussi.kivilinna@iki.fi>
Wed, 12 Aug 2015 14:41:42 +0000 (17:41 +0300)
commite11895da1f4af9782d89e92ba2e6b1a63235b54b
tree1cda3ed44e4ed8362f51bfd6724eec3265d6ca51
parent80321eb3a63a20f86734d6eebb3f419c0ec895aa
Add carryless 8-bit addition fast-path for AES-NI CTR mode

* cipher/rijndael-aesni.c (do_aesni_ctr_4): Do addition using
CTR in big-endian form, if least-significant byte does not overflow.
--

Patch improves AES-NI CTR speed by 20%.

Benchmark on Intel Haswell (3.2 Ghz):

Before:
 AES            |  nanosecs/byte   mebibytes/sec   cycles/byte
        CTR enc |     0.273 ns/B    3489.8 MiB/s     0.875 c/B
        CTR dec |     0.273 ns/B    3491.0 MiB/s     0.874 c/B

After:
        CTR enc |     0.228 ns/B    4190.0 MiB/s     0.729 c/B
        CTR dec |     0.228 ns/B    4190.2 MiB/s     0.729 c/B

Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
cipher/rijndael-aesni.c