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

dsa: migrate to crypto-bigint #784

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

aumetra
Copy link
Contributor

@aumetra aumetra commented Jan 17, 2024

This is a draft. The code is incredibly ugly.
Will clean it up as soon as I got all of the tests to pass.

@tarcieri
Copy link
Member

See also #779 #782

@aumetra
Copy link
Contributor Author

aumetra commented Jan 27, 2024

Small question @tarcieri

let params = BoxedMontyParams::new_vartime(Odd::new((**components.p()).clone()).unwrap());
let form = BoxedMontyForm::new((*y).clone(), params);

if *y < two() || form.pow(components.q()).to_montgomery() != BoxedUint::one() {
    return Err(signature::Error::new());
}

should be equivalent to the following code

if y < two() || y.modpow(components.q(), components.p()) != BigUint::one() {
    return Err(signature::Error::new());
}

Right? Or did I make a mistake with the MontyParams and MontyForms API?

@tarcieri
Copy link
Member

@aumetra I think you may have run into a confusing API we should really fix.

Instead of to_montgomery() you probably want retrieve() or from_montgomery()

(Personally I would've named everything from_canonical and to_canonical)

@aumetra
Copy link
Contributor Author

aumetra commented Jan 27, 2024

Ah. Yeah, that was it. I guess when I wrote the code at an airport I overlooked that in the docs

image

@tarcieri
Copy link
Member

needs an MSRV bump to 1.73 in .github/workflows/dsa.yml

@tarcieri tarcieri changed the title Migrate dsa to crypto-bigint dsa: migrate to crypto-bigint Jan 28, 2024
@tarcieri tarcieri added the dsa Digital Signature Algorithm label Jan 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dsa Digital Signature Algorithm
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants