summary refs log tree commit diff
path: root/crypto/src/math/ec/custom/sec/SecP521R1Point.cs
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2014-02-02 14:49:51 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2014-02-02 14:49:51 +0700
commit17397bac85c830365ee6968fb09373165c6f1dc1 (patch)
treec08e97d99d6be525d19ade2ecb4b098773fe4aa9 /crypto/src/math/ec/custom/sec/SecP521R1Point.cs
parentBring OCB test vectors up-to-date with draft v06 (diff)
downloadBouncyCastle.NET-ed25519-17397bac85c830365ee6968fb09373165c6f1dc1.tar.xz
Minor optimization for secp521r1 point doubling
Diffstat (limited to 'crypto/src/math/ec/custom/sec/SecP521R1Point.cs')
-rw-r--r--crypto/src/math/ec/custom/sec/SecP521R1Point.cs9
1 files changed, 4 insertions, 5 deletions
diff --git a/crypto/src/math/ec/custom/sec/SecP521R1Point.cs b/crypto/src/math/ec/custom/sec/SecP521R1Point.cs
index 5da71f078..2e3a7eccb 100644
--- a/crypto/src/math/ec/custom/sec/SecP521R1Point.cs
+++ b/crypto/src/math/ec/custom/sec/SecP521R1Point.cs
@@ -216,12 +216,11 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec
 
             uint[] S = Y1Squared;
             SecP521R1Field.Multiply(Y1Squared, X1.x, S);
-            SecP521R1Field.Twice(S, S);
-            SecP521R1Field.Twice(S, S);
+            Nat.ShiftUpBits(17, S, 2, 0);
+            SecP521R1Field.Reduce23(S);
 
-            SecP521R1Field.Twice(T, t1);
-            SecP521R1Field.Twice(t1, t1);
-            SecP521R1Field.Twice(t1, t1);
+            Nat.ShiftUpBits(17, T, 3, 0, t1);
+            SecP521R1Field.Reduce23(t1);
 
             SecP521R1FieldElement X3 = new SecP521R1FieldElement(T);
             SecP521R1Field.Square(M, X3.x);