[API BREAK] Make flags more explicit, add runtime checks. #324

pull rustyrussell wants to merge 1 commits into bitcoin-core:master from rustyrussell:flag-safety changing 4 files +39 −21
  1. rustyrussell commented at 4:43 am on September 29, 2015: contributor

    Fewer zeroes, plus check bit to make sure it value is valid.

    Signed-off-by: Rusty Russell rusty@rustcorp.com.au

  2. Make flags more explicit, add runtime checks.
    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    742046526a
  3. jgarzik commented at 12:30 pm on September 29, 2015: none
    ut ACK
  4. in include/secp256k1.h: in 742046526a
    155+# define SECP256K1_CONTEXT_SIGN   (SECP256K1_CONTEXT_SIGN_BIT|SECP256K1_CONTEXT_CHECK_BIT)
    156+# define SECP256K1_CONTEXT_NONE   (SECP256K1_CONTEXT_CHECK_BIT)
    157+
    158+#  define SECP256K1_CONTEXT_VERIFY_BIT     (1 << 2)    
    159+#  define SECP256K1_CONTEXT_SIGN_BIT       (2 << 2)    
    160+#  define SECP256K1_CONTEXT_CHECK_BIT      (1)
    


    apoelstra commented at 11:29 am on October 1, 2015:

    I’d prefer VERIFY and SIGN to be (1 « 0) and (1 « 1); COMPRESSED should also be (1 « 0), and in general the actual flags should be written as (1 « n) for increasing n.

    The CHECK_BITs would then need to be something high, maybe (1 « 10), (1 « 11), etc, which would give us room for ten flags in each of five different flag categories, while still fitting into a 16-bit int.

  5. apoelstra commented at 11:30 am on October 1, 2015: contributor

    Can you add [API BREAK] to the title of this PR?

    Also concept ACK.

  6. rustyrussell renamed this:
    Make flags more explicit, add runtime checks.
    [API BREAK] Make flags more explicit, add runtime checks.
    on Oct 2, 2015
  7. sipa cross-referenced this on Oct 21, 2015 from issue [API BREAK] Explicit flag handling (rebase + modification of #324) by sipa
  8. sipa commented at 7:11 pm on October 25, 2015: contributor
    Superseded by #339.
  9. sipa closed this on Oct 25, 2015


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-25 14:15 UTC

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