Improved AES-CFB performance using AES-NI insn.
There is also a new regression test which tests the bulk
encryption methods we have for a few ciphers (namely AES). A bug in
them could have slipped through because we only did encrypt-decrypt
tests but didn't compared them to fixed vectors.
Benchmarks using gcc 4.4 show a 7 fold speed improvement for CFB
encryption and 14 for decryption. This is a bit strange; someone
should check the code to see why we have this difference.
Without AESNI (undef USE_AESNI in rijndael.c):
$ ./benchmark --cipher-repetitions 100 --alignment 16 cipher aes aes256
Running each test 100 times.
ECB/Stream CBC CFB OFB CTR --------------- --------------- --------------- --------------- ---------------
AES 1370ms 1430ms 1140ms 1190ms 1120ms 1130ms 1520ms 1540ms 1780ms 1770ms
AES256 1780ms 1850ms 1530ms 1610ms 1540ms 1530ms 1930ms 1960ms 2180ms 2180ms
With AESNI:
$ ./benchmark --cipher-repetitions 100 --alignment 16 cipher aes aes256
Running each test 100 times.
ECB/Stream CBC CFB OFB CTR --------------- --------------- --------------- --------------- ---------------
AES 80ms 100ms 240ms 220ms 140ms 70ms 300ms 290ms 490ms 510ms
AES256 130ms 130ms 290ms 270ms 200ms 100ms 340ms 340ms 470ms 470ms
$ ./benchmark --cipher-repetitions 100 --alignment 0 cipher aes aes256
Running each test 100 times.
ECB/Stream CBC CFB OFB CTR --------------- --------------- --------------- --------------- ---------------
AES 80ms 90ms 240ms 230ms 150ms 80ms 290ms 300ms 500ms 530ms
AES256 130ms 130ms 290ms 260ms 190ms 110ms 340ms 340ms 470ms 490ms