Closed noloader closed 7 years ago
Testing your integrated code on the compile farm's gcc117 shows some impressive numbers:
# Without -march=...
noloader@gcc117:~/botan> LD_LIBRARY_PATH=/opt/cfarm/gcc-latest/lib64 ./botan speed --msec=3000 SHA-1 SHA-256
SHA-160 [base] hash 207.170 MiB/sec (621.512 MiB in 3000.006 ms)
SHA-256 [base] hash 154.733 MiB/sec (464.199 MiB in 3000.000 ms)
# With -march=armv8-a+crc+crypto -mtune=cortex-a57
noloader@gcc117:~/botan> LD_LIBRARY_PATH=/opt/cfarm/gcc-latest/lib64 ./botan speed --msec=3000 SHA-1 SHA-256
SHA-160 [base] hash 812.616 MiB/sec (2437.848 MiB in 3000.000 ms)
SHA-256 [base] hash 738.528 MiB/sec (2215.586 MiB in 3000.005 ms)
Merged so closing. Thanks again!
Attached and below is a patch for SHA-224 and SHA-256 using ARM SHA extensions. Its another partial patch, and others will have to complete it.
The code came from the ARM ARM, and the mbedtls experimental implementation by Johannes Schneiders, Barry O'Rourke and Skip Hovsmith.
The dev-boards used for testing were a Pine64 and LeMaker HiKey. Both have CRC and Crypto extensions. Botan was configured with
./configure.py --cc={gcc|clang} --cc-abi="-march=armv8-a+crc+crypto -mtune=cortex-a53"
.Here are the relative numbers:
Be careful of using hwcaps to determine SHA extension availability because its only available on Linux. There is no equivalent on iOS and Windows Phone. The best way I found was a Unix signal handler to catch a
SIGILL
and a__try/__except
block on Windows because they work everywhere. It also avoids the need for EL1 to check a MSR.Here is the updated
sha2_32.cpp
and the diff packaged as a ZIP file.sha2_32_updated.zip