#1073: Caching hash method pointers globally to improve performances - #1077
#1073: Caching hash method pointers globally to improve performances#1077haxelion wants to merge 1 commit into
Conversation
Signed-off-by: Charles Hubain <charles.hubain@linecorp.com>
|
Important 🔀 The Intel® SGX SDK codebase has movedThank you for your contribution! If you have any questions or need assistance migrating, please ask here. As we complete the migration, older pull requests may eventually be closed. No work is lost, though, and you are welcome to re-open your change in the new repository at any time. Footnotes
|
This PR fixes the performance issue with TCrypto hash functions we've observed as explained in issue intel/confidential-computing.sgx.sdk#168.
Summary of the changes
I've also performed the change in RSA and ECC code but haven't benchmarked it. However I don't expect a significant performance uplift in those cases. I simply did it for consistency.
I'm also unsure of what code conventions I should follow so please don't hesitate to ask for such changes.
Performance data
The following benchmark were run on a dual Intel(R) Xeon(R) Silver 4310 system. The support of SHANI amplify the magnitude of the issue so systems without SHANI support will see a smaller uplift.
Benchmarks can be replicated using the enclave code here: https://github.com/haxelion/sgx_tcrypto_bench
The benchmark code perform 1,000,000 iteration of the selected algorithm inside an ECALL. Several of those ECALL are called in parallel from multiple threads. What is expected is that, up to the core count, there shouldn't be any noticeable slowdown.
I've also attached the detailed console output to this PR: Intel TCrypto benchmark data.md.
SHA1
24 threads speed-up: 44x
SHA256
24 threads speed-up: 43x
HMAC-SHA256
24 threads speed-up: 14x
SHA384
24 threads speed-up: 12x