Skip to content

Conversation

@john-moffett
Copy link
Contributor

Flags for constant-time masking rely on the values being exactly 0 or 1 rather than 0 or true (any nonzero). One function, secp256k1_fe_cmov documents and VERIFY_CHECKs this, but most don't.

This updates the documentation and adds VERIFY_CHECKs enforcing flag == 0 || flag == 1 for:

secp256k1_fe_storage_cmov
secp256k1_gej_cmov
secp256k1_ge_storage_cmov
secp256k1_scalar_cadd_bit
secp256k1_scalar_cond_negate
secp256k1_scalar_cmov
secp256k1_int_cmov

Flags for constant-time masking rely
on the values being exactly 0 or 1 rather
than 0 or true. Add VERIFY_CHECKs to enforce
in VERIFY builds as a preventative
measure and add documentation where relevant.
Copy link
Member

@furszy furszy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering if it worth adding a macro for this; something like VERIFY_BOOL_ARG.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants