[SECP256K1] Improve bounds checks in modinv modules
Summary:
This commit adds functions to verify and compare numbers in signed{30,62} notation, and uses that to do more extensive bounds checking on various variables in the modinv code.
Partial backport of secp256k1#831:
https://github.com/bitcoin-core/secp256k1/pull/831/commits/08d54964e51f318ef0cc4ef09d64cfa5ec143c5c
Depends on D9402.
Test Plan:
ninja check-secp256k1
Reviewers: #bitcoin_abc, majcosta
Reviewed By: #bitcoin_abc, majcosta
Differential Revision: https://reviews.bitcoinabc.org/D9403