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

crypto-bigint: add modulo operations to UInt #561

Merged
merged 15 commits into from
Jul 30, 2021
Merged

Conversation

tarcieri
Copy link
Member

@tarcieri tarcieri commented Jul 29, 2021

Continuing on @dignifiedquire's work from #510, this PR attempts to simplify the implementation.

Aspirationally, the goal is to add equivalence tests with a known-good implementation. Proptests against num-bigint added.

@tarcieri tarcieri force-pushed the crypto-bigint/mod-ops branch from bc9c95a to 77a60c5 Compare July 29, 2021 03:28
@tarcieri tarcieri changed the title crypto-bigint: add modulo operations to UInt [WIP] crypto-bigint: add modulo operations to UInt Jul 29, 2021
@tarcieri tarcieri force-pushed the crypto-bigint/mod-ops branch 2 times, most recently from 6774279 to 1256d09 Compare July 29, 2021 03:34
@tarcieri tarcieri force-pushed the crypto-bigint/mod-ops branch from 1256d09 to 63e6751 Compare July 29, 2021 13:57
@tarcieri
Copy link
Member Author

Added some trait wrappers in 2b37f48. A couple notes:

  • used macros to impl them for 1..=12 limbs, but you can potentially omit some of those and add different impls
  • they have the same name as the const fn which is a bit annoying/confusing, but has mostly worked out in the elliptic curve crates
  • I added debug_asserts for < p

Ideally we can eventually replace that with const impl and specialization in some hypothetical future.

@tarcieri tarcieri force-pushed the crypto-bigint/mod-ops branch from 2b37f48 to 54a3c47 Compare July 29, 2021 21:54
@tarcieri
Copy link
Member Author

@dignifiedquire I tried to write a proptest for add_mod in 54a3c47, but it's failing:

https://github.com/RustCrypto/utils/pull/561/checks?check_run_id=3196567313

However the code looks correct to me, so I'm not sure if there's something wrong with the test itself or the code.

@tarcieri tarcieri force-pushed the crypto-bigint/mod-ops branch from bcbba92 to f6f545f Compare July 30, 2021 14:25
@tarcieri tarcieri changed the title [WIP] crypto-bigint: add modulo operations to UInt crypto-bigint: add modulo operations to UInt Jul 30, 2021
@tarcieri tarcieri marked this pull request as ready for review July 30, 2021 14:37
@tarcieri tarcieri merged commit a7a0b97 into master Jul 30, 2021
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