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

performances improvement #44

Open
rdubois-crypto opened this issue Dec 1, 2024 · 3 comments
Open

performances improvement #44

rdubois-crypto opened this issue Dec 1, 2024 · 3 comments

Comments

@rdubois-crypto
Copy link

rdubois-crypto commented Dec 1, 2024

Since last update, tx hashing on ledger is really slow for a good UX.

Wonder If side channel countermeasures are activated to protect a public hash when using the modpow here:

If so use a plain modpow, might ease things. Furthermore, poseidon only requires x^3 (two mulmod).

Allocations seem also to be repeated at each round and could be done once.

@yogh333
Copy link
Collaborator

yogh333 commented Dec 4, 2024

@rdubois-crypto Hello, there has not been any change regarding BN functions with the new OS. Maybe performance decrease might be due to the fact that Tx v3 are now more heavily used (poseidon) whereas it was Tx v1 (pedersen) before ? Poseidon is much longer to compute on device than Pedersen...

@rdubois-crypto
Copy link
Author

rdubois-crypto commented Dec 4, 2024

@yogh333 , it would be interesting to bench if replacing the bn_mod_pow by two multiplications to compute the x^3 mod p provides better performances. modpow is potentially using the whole maximal length of modulus to provide side channel countermeasure. As this part is not open, it is only an assumption tho.

protecting modpow when signing against SCA makes sense, it does not for hashing.

@yogh333
Copy link
Collaborator

yogh333 commented Dec 4, 2024

@rdubois-crypto yes thanks for the suggestion, I will try 😉

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

No branches or pull requests

2 participants