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

Implement new policy for VERIFY_CHECK and #ifdef VERIFY (issue #1381) #1393

Commits on Nov 30, 2023

  1. redefine VERIFY_CHECK to empty in production (non-VERIFY) mode

    As suggested in issue bitcoin-core#1381, this will make things simpler and
    improve code readability, as we don't need to force omitting of
    evaluations on a case-by-case basis anymore and hence can remove
    lots of `#ifdef VERIFY`/`#endif` lines (see next commit). Plus,
    VERIFY_CHECK behaves now identical in both non-VERIFY and coverage mode,
    making the latter not special anymore and hopefully decreasing
    maintenance burden. The idea of "side-effect safety" is given up.
    
    Note that at two places in the ellswift module void-casts of return
    values have to be inserted for non-VERIFY builds, in order to avoid
       "variable ... set but not used [-Wunused-but-set-variable]"
    warnings.
    theStack committed Nov 30, 2023
    Configuration menu
    Copy the full SHA
    c2688f8 View commit details
    Browse the repository at this point in the history
  2. remove superfluous #ifdef VERIFY/#endif preprocessor conditions

    Now that the `VERIFY_CHECK` compiles to empty in non-VERIFY mode, blocks
    that only consist of these macros don't need surrounding `#ifdef VERIFY`
    conditions anymore.
    
    At some places intentional blank lines are inserted for grouping and
    better readadbility.
    theStack committed Nov 30, 2023
    Configuration menu
    Copy the full SHA
    5d89bc0 View commit details
    Browse the repository at this point in the history
  3. introduce and use SECP256K1_{FE,GE,GEJ}_VERIFY macros

    By providing an uppercase variant of these verification functions, it is
    better visible that it is test code and surrounding `#ifdef VERIFY`
    blocks can be removed (if there is no other code around that could
    remain in production mode), as they don't serve their purpose any more.
    
    At some places intentional blank lines are inserted for grouping and
    better readadbility.
    theStack committed Nov 30, 2023
    Configuration menu
    Copy the full SHA
    cf25c86 View commit details
    Browse the repository at this point in the history

Commits on Dec 1, 2023

  1. introduce and use SECP256K1_SCALAR_VERIFY macro

    By providing an uppercase variant of these verification functions,
    it is better visible that it is test code.
    theStack committed Dec 1, 2023
    Configuration menu
    Copy the full SHA
    a0fb68a View commit details
    Browse the repository at this point in the history
  2. remove unneeded VERIFY_SETUP uses in ECMULT_CONST_TABLE_GET_GE macro

    As the fields r->x and r->y are set immediately after (three lines
    below), there is no need to clear them.
    theStack committed Dec 1, 2023
    Configuration menu
    Copy the full SHA
    a3a3e11 View commit details
    Browse the repository at this point in the history
  3. remove VERIFY_SETUP define

    This define was seemingly introduced for VERIFY mode code with side
    effects (for setup purposes), that should just be executed without any
    checks. The same can be achieved by putting it in an `#if VERIFY` block,
    so we can remove it.
    theStack committed Dec 1, 2023
    Configuration menu
    Copy the full SHA
    bb46723 View commit details
    Browse the repository at this point in the history