summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Langley <agl@imperialviolet.org>2017-01-16 11:53:38 -0800
committerAdam Langley <agl@imperialviolet.org>2017-01-16 11:53:38 -0800
commit33e7db2c69e76bd027b05381f89ad1dbd35707b6 (patch)
treee16fc10f80122509654e37699d5e09a47a02c8a6
parent278e1ec8e8a6e017cd07577924d6766039146ced (diff)
downloaded25519-33e7db2c69e76bd027b05381f89ad1dbd35707b6.tar.xz
Fix the naming of sqrtMinusA.
It was never sqrt(-A), it was sqrt(-(A+2)), and it wasn't the minimal root either.
-rw-r--r--extra25519/extra25519.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/extra25519/extra25519.go b/extra25519/extra25519.go
index 571218f..e8bedaf 100644
--- a/extra25519/extra25519.go
+++ b/extra25519/extra25519.go
@@ -55,9 +55,9 @@ func PublicKeyToCurve25519(curve25519Public *[32]byte, publicKey *[32]byte) bool
return true
}
-// sqrtMinusA is sqrt(-486662)
-var sqrtMinusA = edwards25519.FieldElement{
- 12222970, 8312128, 11511410, -9067497, 15300785, 241793, -25456130, -14121551, 12187136, -3972024,
+// sqrtMinusAPlus2 is sqrt(-(486662+2))
+var sqrtMinusAPlus2 = edwards25519.FieldElement{
+ -12222970, -8312128, -11511410, 9067497, -15300785, -241793, 25456130, 14121551, -12187136, 3972024,
}
// sqrtMinusHalf is sqrt(-1/2)
@@ -114,7 +114,7 @@ func ScalarBaseMult(publicKey, representative, privateKey *[32]byte) bool {
var v edwards25519.FieldElement
edwards25519.FeMul(&v, &t0, &inv1)
edwards25519.FeMul(&v, &v, &A.Z)
- edwards25519.FeMul(&v, &v, &sqrtMinusA)
+ edwards25519.FeMul(&v, &v, &sqrtMinusAPlus2)
var b edwards25519.FieldElement
edwards25519.FeAdd(&b, &u, &edwards25519.A)