diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2014-01-31 14:03:42 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2014-01-31 14:03:42 +0700 |
commit | 6ef613d8f18384fb434cb4b99db979d30a5418f5 (patch) | |
tree | a028ec92618a6fd95edb80b6724458175730948f /crypto/src/math/ec/custom/sec | |
parent | Use BigInteger.One instead of BigInteger.ValueOf(1) (diff) | |
download | BouncyCastle.NET-ed25519-6ef613d8f18384fb434cb4b99db979d30a5418f5.tar.xz |
Unroll MulWordAddExt
Diffstat (limited to 'crypto/src/math/ec/custom/sec')
-rw-r--r-- | crypto/src/math/ec/custom/sec/Nat256.cs | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/crypto/src/math/ec/custom/sec/Nat256.cs b/crypto/src/math/ec/custom/sec/Nat256.cs index a55e7bc0d..12a860bf1 100644 --- a/crypto/src/math/ec/custom/sec/Nat256.cs +++ b/crypto/src/math/ec/custom/sec/Nat256.cs @@ -358,14 +358,30 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec Debug.Assert(yyOff <= 8); Debug.Assert(zzOff <= 8); ulong c = 0, xVal = x; - int i = 0; - do - { - c += xVal * yy[yyOff + i] + zz[zzOff + i]; - zz[zzOff + i] = (uint)c; - c >>= 32; - } - while (++i < 8); + c += xVal * yy[yyOff + 0] + zz[zzOff + 0]; + zz[zzOff + 0] = (uint)c; + c >>= 32; + c += xVal * yy[yyOff + 1] + zz[zzOff + 1]; + zz[zzOff + 1] = (uint)c; + c >>= 32; + c += xVal * yy[yyOff + 2] + zz[zzOff + 2]; + zz[zzOff + 2] = (uint)c; + c >>= 32; + c += xVal * yy[yyOff + 3] + zz[zzOff + 3]; + zz[zzOff + 3] = (uint)c; + c >>= 32; + c += xVal * yy[yyOff + 4] + zz[zzOff + 4]; + zz[zzOff + 4] = (uint)c; + c >>= 32; + c += xVal * yy[yyOff + 5] + zz[zzOff + 5]; + zz[zzOff + 5] = (uint)c; + c >>= 32; + c += xVal * yy[yyOff + 6] + zz[zzOff + 6]; + zz[zzOff + 6] = (uint)c; + c >>= 32; + c += xVal * yy[yyOff + 7] + zz[zzOff + 7]; + zz[zzOff + 7] = (uint)c; + c >>= 32; return (uint)c; } |