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

Generate bignum test data for most operation functions #5959

Open
gilles-peskine-arm opened this issue Jun 19, 2022 · 0 comments
Open

Generate bignum test data for most operation functions #5959

gilles-peskine-arm opened this issue Jun 19, 2022 · 0 comments
Labels
component-crypto Crypto primitives and low-level interfaces enhancement size-m Estimated task size: medium (~1w)

Comments

@gilles-peskine-arm
Copy link
Contributor

gilles-peskine-arm commented Jun 19, 2022

Bignum operation functions are currently tested with manually written data. This has several downsides:

  • The coverage is somewhat hard to evaluate, and as a result tends to have unexpected gaps. (For example, forgetting test cases with leading zeros.)
  • It's somewhat tedious to verify that the test data is actually correct.
  • Tests are tedious to write, so we tend to write fewer than we should.
  • There are occasional copy-pasta mistakes in test case descriptions.

The goal of this task is to convert most bignum test data to automatically generated test cases, using the script from #5921.

Guidance:

  • Use Python to calculate test data. For example, test cases for add have three parameters (left-hand side, right-hand side, expected result); calculate the expected result as lhs + rhs. This way, we can write more test data with and it will automatically be correct.
  • Only use base 16 for test data. Convert bignum operation tests from explicit radix to base 16 #5956 should probably be done first (it isn't strictly necessary but will make the code and review simpler).
  • This task is about bignum operations (e.g. add, shift, exponentiation, …). Random generation, primality testing and read/write are out of scope.
  • I don't expect that the .function file will need to change.
  • Generate meaningful test descriptions (no more “base test DTLS #1”).
  • Remove manually written test data if there is now an automatically generated test case with identical data.
  • There is no particular coverage goal here. Do what is reasonably easy.

Prerequisites:

Follow-ups:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component-crypto Crypto primitives and low-level interfaces enhancement size-m Estimated task size: medium (~1w)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant