Add built-in self-tests and test vectors. #217

pull gmaxwell wants to merge 2 commits into bitcoin-core:master from gmaxwell:bist changing 9 files +1936 −1
  1. gmaxwell commented at 8:21 am on February 17, 2015: contributor

    This has a collection of static test vectors which were both randomly and hand created and then machine reduced. All of the vectors were tested against OpenSSL for agreement.

    The vectors are checked at _start(), unless specifically built with the them disabled (e.g. to reduce binary size.).

    LCOV claims 91% branch coverage with the tests now.

  2. gmaxwell commented at 8:22 am on February 17, 2015: contributor
    I guess for discuss right now, I’m not super happy that the branch coverage is only 91%. I’m not sure what opinions are about running these things at startup, they do considerably slow down start. They could be trimmed down to a smaller set to make them faster.
  3. gmaxwell commented at 8:26 am on February 17, 2015: contributor

    Here is a recent lcov run with this patch in: http://people.xiph.org/~greg/secp256k1.bist1/

    There are some unhit branches which are cryptographically unreachable, e.g. ecdsa_impl.h:206, and others are just serialization handling which would be easy enough to hit if thats what I was currently attempting. I’m most irritated right now with the uncovered carries in the scalar code, but I haven’t tried to specifically craft something to hit them yet.

  4. in src/bist.h: in b474cd12a5 outdated
    0@@ -0,0 +1,17 @@
    1+/**********************************************************************
    2+ * Copyright (c) 2014                                                 *
    


    sipa commented at 9:51 am on February 21, 2015:
    You can put your name here :)
  5. sipa commented at 10:03 am on February 21, 2015: contributor
    Doesn’t compile with –enable-benchmark.
  6. gmaxwell commented at 10:08 am on February 21, 2015: contributor
    Hmph. Pretty sure it did at one point, I must have hosed it on a rebase. Will fix!
  7. sipa commented at 2:56 pm on February 21, 2015: contributor
    It only fails with non-standard -O options. I suppose it’s something that’s expected to be inlined but becomes an external symbol otherwise.
  8. sipa commented at 1:50 am on February 22, 2015: contributor
  9. sipa cross-referenced this on Feb 23, 2015 from issue Initial gcov work by cbatson
  10. sipa commented at 11:43 am on February 24, 2015: contributor
    For me, this increases the time for a secp256k1_start(SECP256K1_START_VERIFY | SECP256K1_START_SIGN) from 15ms to 53ms.
  11. Make secp256k1_ec_pubkey_create reject oversized secrets. 6682347860
  12. Add built-in self-tests and test vectors.
    This has a collection of static test vectors which were both randomly
     and hand created and then machine reduced.  All of the vectors were
     tested against OpenSSL for agreement.
    
    The vectors are checked at _start(), unless specifically built with
     the them disabled.
    
    LCOV claims 91% branch coverage with the tests now.
    641e28647f
  13. gmaxwell added this to the milestone initial release on Aug 31, 2015
  14. jtimon commented at 1:42 pm on March 21, 2017: none
    Fast review ACK. Needs rebase.
  15. gmaxwell closed this on Jun 11, 2019


gmaxwell sipa jtimon

Milestone
stable release (1.0.0-rc.1)


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: 2024-11-24 21:15 UTC

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