Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a speed_common script to benchmark OQS AES and hash algorithms #1144

Merged
merged 2 commits into from
Dec 5, 2021
Merged

Conversation

tedeaton
Copy link
Contributor

@tedeaton tedeaton commented Dec 3, 2021

This adds a speed_common script, similar to speed_kem and speed_sig, but for benchmarking the encryption and hashing algorithms that liboqs uses. Specifically, it benchmarks AES128, AES256, SHA256, SHA384, SHA512, SHA3-256, SHA3-384, SHA3-512, SHA3-shake128, and SHA3-shake256. Currently it only benchmarks the main API of each of the hash algorithms, not the incremental version (that is something that could be added later if it's needed).

The script has a few options to change how it is run:
--msglen n : Each algorithm is benchmarked with a message length of n bytes (must be a multiple of 16 to benchmark AES)
--outlen n : For algorithms with variable-length output (e.g., shake128), specifies the output length.
<alg> : Only benchmark a specific algorithm.

Fulfills request in #1143

  • Does this PR change the input/output behaviour of a cryptographic algorithm (i.e., does it change known answer test values)? (If so, a version bump will be required from x.y.z to x.(y+1).0.)
  • Does this PR change the the list of algorithms available -- either adding, removing, or renaming? (If so, PRs in OQS-OpenSSL, OQS-BoringSSL, and OQS-OpenSSH will also be required by the time this is merged.)

Copy link
Member

@baentsch baentsch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking on this issue! The logic in this PR departs from the pre-existing speed_kem|sig (and test_aes -b) apps though, in that it requires an algorithm parameter to run. Instead, not passing an algorithm name should lead to all algs being tested. Further, it would be prudent to have a default set of message lengths be run if that parameter is not given (analogous to openssl speed).

@tedeaton
Copy link
Contributor Author

tedeaton commented Dec 4, 2021

That should be how the script works already, unless I messed up the input parsing. If no algorithm is specified, then single_alg never gets set, and each algorithm should be run. Similarly, message_len is set to 64 bytes by default.

@baentsch
Copy link
Member

baentsch commented Dec 5, 2021

That should be how the script works already

Sincere apologies: Indeed I overlooked that in the code and didn't actually run the code before. After doing this now, this is to confirm this PR indeed completely implements #1143. Thanks!

@baentsch baentsch merged commit cf6535d into open-quantum-safe:main Dec 5, 2021
@baentsch baentsch mentioned this pull request Dec 5, 2021
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants