Add gungraun constant-time benchmarks and checker
This is a proof of concept for using Gungraun for testing constant-timeness of the operations. The purpose of this PR is less so getting it merged, and more so gauging your interest in this work.
Gungraun uses Valgrind tooling to obtain accurate instruction counts for benchmark executions. This allows comparing runs on different inputs to see if the instruction counts are the same.
I added a number of Gungraun benchmarks, along with a simple binary to process the results (with the intention of using it in CI pipeline). Interestingly, I found that while Gungraun calculates the exact same instruction count for add/sub/mul and GCD operations, it finds tiny differences between mod_pow runs on different arguments (on the order of 0.005% difference in instruction counts).
Are you interested in including this in crypto-bigint test suite? If so, do you have any suggestions for next steps? Some of the ones I see are:
- adding more benchmarks to get higher coverage
- polishing it up and including in CI (for the purposes of constant timeness checking, but we could also get performance regression detection as side benefit)
- investigate exactly why the instruction counts are different for
mod_pow.
Thanks for your feedback!