x/crypto: edwards25519.go has unnecessary code that does not appear in reference or other implementations #37536
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:
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:
Perhaps this was debugging code that was left in on accident? Or is there some real utility that I am just not seeing?
The text was updated successfully, but these errors were encountered:
@FiloSottile It seems questionable to have off reference code with no documented purpose in a crypto package.
It is especially strange since it "appears" to do nothing.
It doesn't change the answer.
It does process a meaningful number. It changes the representation of that number. But to what end....?
I'd like to believe it is there to mitigate some side channel attack. But without any documentation, I am far more concerned that it could create a side channel attack.