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

x/crypto: edwards25519.go has unnecessary code that does not appear in reference or other implementations #37536

Open
WernerVasquez opened this issue Feb 28, 2020 · 1 comment

Comments

@WernerVasquez
Copy link

@WernerVasquez WernerVasquez commented Feb 28, 2020

The following code located at https://github.com/golang/crypto/blob/2aa609cf4a9d7d1126360de73b55b6002f9e052a/ed25519/internal/edwards25519/edwards25519.go#L750 is unnecessary and is not in the reference or many other widely used implementations:

		FeToBytes(&tmpX, &p.X)
		for i, v := range tmpX {
			tmp2[31-i] = v
		}

While FeToBytes does change the form of p.X, but it does not impact the point represented by p.

tmpX and tmp2 are never used for anything beyond this snippet.

Obviously, the declaration of the variables at line 738 is also not needed.

See the following to verify this code is not present in the ref10 implementation:

https://github.com/floodyberry/supercop/blob/a351f2c29235512a042d4b6989d241a67e86ad23/crypto_sign/ed25519/ref10/ge_frombytes.c#L42

Perhaps this was debugging code that was left in on accident? Or is there some real utility that I am just not seeing?

@gopherbot gopherbot added this to the Unreleased milestone Feb 28, 2020
@ALTree
Copy link
Member

@ALTree ALTree commented Feb 28, 2020

@ALTree ALTree changed the title x/crypto: ed25519/internal/edwards25519/edwards25519.go Unnecessary code that does not appear in reference or other implementations x/crypto: edwards25519.go has nnecessary code that does not appear in reference or other implementations Feb 28, 2020
@ALTree ALTree changed the title x/crypto: edwards25519.go has nnecessary code that does not appear in reference or other implementations x/crypto: edwards25519.go has unnecessary code that does not appear in reference or other implementations Feb 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.