botan
botan copied to clipboard
Add basic asymmetric roundtrip tests
Pull Request Dependencies
- #4318
Description
This piggy-backs on the PK_Key_Generation_Test to perform basic roundtrip tests for Sign/Verify, Encrypt/Decrypt, Encaps/Decaps, and Key Agreement, depending on the capabilities of the keys.
The goal is explicitly not to be an exhaustive test but rather be a centralized sanity-check for the PK_*** operators and their meta-data methods. We added it mostly to serve as a place for testing whether the new set_associated_data() setting survives multiple signature/verify operations; and figured that it doesn't hurt to roundtrip-test all the other flavors as well.
This could probably also replace some of the roundtrip-tests in the new PQ implementations. We'll look into cleaning up their test harnesses after the FIPSes are implemented and merged.
Caveat
We'll have to have a look at whether that adds too much time to the test harness. Edit: it almost doubles the runtime of the entire unit test harness on my laptop. That's probably not okay! Hence, in test runs that don't set --run-long-tests we only run those roundtrips for the first parameter set of each algorithm.
coverage: 91.277% (+0.007%) from 91.27% when pulling 15d44b739e0ba3e069ed776485d499bf9e0e030f on Rohde-Schwarz:test/asym_roundtrips into c2491c7808e92527146c3dbe88608b664804549a on randombit:master.
This will need to be revisited once #4318 has converged and landed. I converted it to a draft PR.