diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2014-02-26 20:13:52 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2014-02-26 20:13:52 +0700 |
commit | 57d401f1c1919e507eb42ac0964a8b5d61ee6049 (patch) | |
tree | 413d79b8d57700b9270ab4533787474910e44822 /crypto/src/math/ec/custom/sec/SecP224K1Point.cs | |
parent | Optimize Sqrt() for custom curve secp224k1 (diff) | |
download | BouncyCastle.NET-ed25519-57d401f1c1919e507eb42ac0964a8b5d61ee6049.tar.xz |
Optimization for custom curve reduction when only a few bits need reducing; used to delay reduction in point doubling.
Diffstat (limited to 'crypto/src/math/ec/custom/sec/SecP224K1Point.cs')
-rw-r--r-- | crypto/src/math/ec/custom/sec/SecP224K1Point.cs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/crypto/src/math/ec/custom/sec/SecP224K1Point.cs b/crypto/src/math/ec/custom/sec/SecP224K1Point.cs index f85c64981..c7119401d 100644 --- a/crypto/src/math/ec/custom/sec/SecP224K1Point.cs +++ b/crypto/src/math/ec/custom/sec/SecP224K1Point.cs @@ -205,12 +205,11 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec uint[] S = Y1Squared; SecP224K1Field.Multiply(Y1Squared, X1.x, S); - SecP224K1Field.Twice(S, S); - SecP224K1Field.Twice(S, S); + uint c = Nat.ShiftUpBits(7, S, 2, 0); + SecP224K1Field.Reduce32(c, S); - SecP224K1Field.Twice(T, t1); - SecP224K1Field.Twice(t1, t1); - SecP224K1Field.Twice(t1, t1); + c = Nat.ShiftUpBits(7, T, 3, 0, t1); + SecP224K1Field.Reduce32(c, t1); SecP224K1FieldElement X3 = new SecP224K1FieldElement(T); SecP224K1Field.Square(M, X3.x); |