Intel SHA extensions available

56 views
Skip to first unread message

Jeffrey Walton

unread,
Dec 1, 2016, 4:37:31 PM12/1/16
to Crypto++ Users
Hi Everyone,

SHA1 and SHA256 were updated to use Intel's SHA extensions when available. The implementations are intrinsic based. The code was based on Intel's https://software.intel.com/en-us/articles/intel-sha-extensions; and Sean Gulley code available on GitHub. Gulley's code was very helpful since it filled in a few missing pieces.

The commits of interest are:

* Feature detection: http://github.com/weidai11/cryptopp/commit/ac01277d93636cd7cb9163555e2d929c39849371
* SHA1: http://github.com/weidai11/cryptopp/commit/7ab9b00f909b823f41abed023f40f4957e4cb20a
* SHA256: http://github.com/weidai11/cryptopp/commit/cce56d3f79f739339e17746c3c4cdcba7297483b

There were other miscellaneous check-ins. They include adding all of NIST's CAVP test vectors; supplementing the test script to verify code generation, supplementing the test script to pair old hardware with a new compiler and SHA, etc.

Throughput improved for both SHA1 and SHA256. I don't have a good accounting of cycles per byte due to TurboBoost on the Celeron J3455 test machine, but relative measurements look good:

Baseline
==========================
* SHA1, CXX: 9.7 cpb
* SHA256, SSE2 ASM: 19.5 cpb

SHA Exensions
==========================
* SHA1, Clang: 2.7 cpb
* SHA1, GCC: 3.0 cpb
* SHA256, Clang: 3.9 cpb
* SHA256, GCC: 4.0 cpb

You will need GCC 5, Clang 3.7, or Visual Studio 2015. GCC and Clang tested OK under Debian 8.6. I was able to test the compile under Visual Studio, but I don't have a Windows test machine with a capable cpu, so its untested at runtime.

Jeff
Reply all
Reply to author
Forward
0 new messages