It wasn't clear how the library handles generation of secp256k1 scalars when provided with bytes representing a value that overflows the curve order, since simply performing modular reduction induces bias. It turns out that this case is properly rejected, even though the documentation wasn't particularly clear that this would occur.
This PR adds a sanity test demonstrating rejection cases (and a success case, just for the heck of it).
Type of Change
[ ] Bug fix (non-breaking change which fixes an issue)
[ ] New feature/Enhancement (non-breaking change which adds functionality or enhances an existing one)
[ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
[ ] Documentation update
[ ] Refactor
[x] New or updated tests
Checklist
[x] I have performed a self-review of my code.
[x] I have commented my code where necessary.
[x] I have updated the documentation if needed.
[x] My changes do not introduce new warnings.
[x] I have added tests that prove my changes are effective or that my feature works.
Yeah, I noted ECDSA keys only to match the underlying library structure that generates them. I've updated to make it more clear that this is really just about secp256k1 scalar ranges.
Description
It wasn't clear how the library handles generation of
secp256k1
scalars when provided with bytes representing a value that overflows the curve order, since simply performing modular reduction induces bias. It turns out that this case is properly rejected, even though the documentation wasn't particularly clear that this would occur.This PR adds a sanity test demonstrating rejection cases (and a success case, just for the heck of it).
Type of Change
Checklist
Related Issues
None.