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

Please implement constant time montgomery mulitplication #170

Open
bastien-roucaries opened this issue Aug 21, 2017 · 4 comments
Open

Please implement constant time montgomery mulitplication #170

bastien-roucaries opened this issue Aug 21, 2017 · 4 comments

Comments

@bastien-roucaries
Copy link

Could you please implement this kind of mult:
https://github.com/libressl-portable/openbsd/blob/57dcd4329d83bff3dd67a293d5c4a53b795c587e/src/lib/libcrypto/bn/bn_exp.c#L641-L646

It will be useful for browserify/diffie-hellman#22

@axic
Copy link
Contributor

axic commented Nov 29, 2017

I wonder how much safety this would actually provide given the interpreted/JITed nature of Javascript?

@indutny
Copy link
Owner

indutny commented Nov 30, 2017

This is not obvious, but it might be worth exploration.

@dcousens
Copy link
Contributor

dcousens commented Jun 6, 2018

Keep open as debt or close? Someone can always open a PR if necessary.

@Artoria2e5
Copy link

For anyone trying to look at this later, the problem in redPow that debian noted is the bit === 0 && current === 0 stuff as it performs differential treatment of different bits, skipping through consecutive zeros and allowing some classic DH timing stuff to happen. The rest looks mostly fine: mul is linear to input size; add / sub is trying to be clever but not too much.

It should be possible to just add a flag to disable the check. Someone will have to bench it and see there is any difference though.

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

No branches or pull requests

5 participants