Add Aarch64 assembly implementation of Twofish
* cipher/Makefile.am: Add 'twofish-aarch64.S'. * cipher/twofish-aarch64.S: New. * cipher/twofish.c: Enable USE_ARM_ASM if __AARCH64EL__ and HAVE_COMPATIBLE_GCC_AARCH64_PLATFORM_AS defined. * configure.ac [host=aarch64]: Add 'twofish-aarch64.lo'.
Patch adds ARMv8/Aarch64 implementation of Twofish.
Benchmark on Cortex-A53 (1152 Mhz):
Before:
TWOFISH | nanosecs/byte mebibytes/sec cycles/byte
ECB enc | 27.51 ns/B 34.67 MiB/s 31.69 c/B ECB dec | 26.37 ns/B 36.17 MiB/s 30.38 c/B CBC enc | 28.64 ns/B 33.29 MiB/s 33.00 c/B CBC dec | 26.21 ns/B 36.39 MiB/s 30.19 c/B CFB enc | 28.54 ns/B 33.42 MiB/s 32.88 c/B CFB dec | 27.40 ns/B 34.81 MiB/s 31.56 c/B OFB enc | 28.38 ns/B 33.61 MiB/s 32.69 c/B OFB dec | 28.37 ns/B 33.61 MiB/s 32.69 c/B CTR enc | 27.57 ns/B 34.60 MiB/s 31.76 c/B CTR dec | 27.57 ns/B 34.60 MiB/s 31.76 c/B CCM enc | 55.28 ns/B 17.25 MiB/s 63.69 c/B CCM dec | 55.29 ns/B 17.25 MiB/s 63.70 c/B CCM auth | 27.83 ns/B 34.27 MiB/s 32.06 c/B GCM enc | 28.86 ns/B 33.04 MiB/s 33.25 c/B GCM dec | 28.87 ns/B 33.04 MiB/s 33.25 c/B GCM auth | 1.30 ns/B 731.9 MiB/s 1.50 c/B OCB enc | 29.69 ns/B 32.12 MiB/s 34.20 c/B OCB dec | 28.50 ns/B 33.47 MiB/s 32.83 c/B OCB auth | 29.04 ns/B 32.84 MiB/s 33.45 c/B =
After (~1.3x faster):
TWOFISH | nanosecs/byte mebibytes/sec cycles/byte
ECB enc | 19.97 ns/B 47.77 MiB/s 23.00 c/B ECB dec | 18.29 ns/B 52.16 MiB/s 21.06 c/B CBC enc | 20.94 ns/B 45.54 MiB/s 24.13 c/B CBC dec | 18.34 ns/B 52.00 MiB/s 21.13 c/B CFB enc | 20.83 ns/B 45.77 MiB/s 24.00 c/B CFB dec | 19.97 ns/B 47.76 MiB/s 23.00 c/B OFB enc | 20.94 ns/B 45.54 MiB/s 24.13 c/B OFB dec | 20.94 ns/B 45.54 MiB/s 24.13 c/B CTR enc | 20.19 ns/B 47.24 MiB/s 23.26 c/B CTR dec | 20.19 ns/B 47.24 MiB/s 23.26 c/B CCM enc | 40.53 ns/B 23.53 MiB/s 46.69 c/B CCM dec | 40.53 ns/B 23.53 MiB/s 46.69 c/B CCM auth | 20.40 ns/B 46.74 MiB/s 23.50 c/B GCM enc | 21.49 ns/B 44.39 MiB/s 24.75 c/B GCM dec | 21.48 ns/B 44.39 MiB/s 24.75 c/B GCM auth | 1.30 ns/B 731.8 MiB/s 1.50 c/B OCB enc | 22.15 ns/B 43.05 MiB/s 25.52 c/B OCB dec | 20.47 ns/B 46.58 MiB/s 23.59 c/B OCB auth | 21.64 ns/B 44.07 MiB/s 24.93 c/B =
- Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>