Adds 32 static test vectors for scalar mul, sqr, inv. #344

pull gmaxwell wants to merge 1 commits into bitcoin-core:master from gmaxwell:scalar_test_vectors changing 1 files +578 −0
  1. gmaxwell commented at 7:08 AM on October 30, 2015: contributor

    These were generated by testing more than 10^12 random test vectors for coverage on instrumented (comparison operator outcomes) 32-bit and 64-bit code, plus additional edge condition requirements (e.g. inputs of 0, 1, -1) and then solving a minimum set cover problem.

    The required responses were generated with Sage.

    This significantly improves the lcov branch coverage report and makes the tests much more sensitive to mutation testing of the scalar code.

  2. sipa commented at 5:22 PM on October 30, 2015: contributor

    Any reason for not using SECP256K1_SCALAR_CONST?

  3. gmaxwell commented at 7:11 PM on October 30, 2015: contributor

    No-- didn't think to, but on consideration: this way tests the set operation. Would you hate me terribly if I made one of the two tables use the macros and continued to use the function for the other?

  4. sipa commented at 8:58 PM on October 30, 2015: contributor

    @gmaxwell Well specifically for the all 0xFF value; using SECP256K1_CONST_SCALAR likely keeps working longer even if the scalar implementation/representation changes.

  5. Adds 32 static test vectors for scalar mul, sqr, inv.
    These were generated by testing more than 10^12 random test vectors
     for coverage on instrumented (comparison operator outcomes) 32-bit
     and 64-bit code, plus additional edge condition requirements (e.g.
     inputs of 0, 1, -1) and then solving a minimum set cover problem.
    
    The required responses were generated with Sage.
    
    This significantly improves the lcov branch coverage report and
     makes the tests much more sensitive to mutation testing of the
     scalar code.
    
    The challenges and responses are in the form of pairs of scalars:
      C1 * C2 == R1
      (C1 * C2) * (1 / C2) == C1
      C2 * (1 / C2) == 1
      C1 * C1 == R2
      C1^2    == R2
    26abce75ea
  6. gmaxwell commented at 9:18 PM on October 30, 2015: contributor

    @sipa Changed the all 0xFF case.

  7. sipa merged this on Oct 31, 2015
  8. sipa closed this on Oct 31, 2015

  9. sipa referenced this in commit b4d17da903 on Oct 31, 2015
Contributors

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin-core/secp256k1. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-14 11:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me