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

Ed25519 KeyExchange performance improvement #12

Open
mishamosher opened this issue Jul 6, 2016 · 0 comments
Open

Ed25519 KeyExchange performance improvement #12

mishamosher opened this issue Jul 6, 2016 · 0 comments

Comments

@mishamosher
Copy link

mishamosher commented Jul 6, 2016

The method KeyExchange(ArraySegment<byte>, ArraySegment<byte>, ArraySegment<byte>) defined in the file Chaos.NaCl/Ed25519.cs performs an unnecessary ScalarOperations.sc_clamp(byte[], int) operation (link with details: Chaos.NaCl/Ed25519.cs on Line 140).

This is beacuse the following line calls MontgomeryOperations.scalarmult(out sharedMontgomeryX, h, 0, ref montgomeryX), which in turn will end calling the very same sc_clamp operation on Chaos.NaCl/Internal/Ed25519Ref10/scalarmult.cs on Line 39.

Simple fix (for a very small performance gain) is to simply remove the unnecessary ScalarOperations.sc_clamp(byte[], int) operation. Already tested and KeyExchange keeps working as expected after removing Chaos.NaCl/Ed25519.cs on Line 140).

@mishamosher mishamosher changed the title KeyExchange test correctness Ed25519 KeyExchange performance improvement Jul 6, 2016
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

1 participant