summary refs log tree commit diff
path: root/crypto/src/math/raw/Nat256.cs
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2019-08-02 16:52:44 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2019-08-02 16:52:44 +0700
commitb033b509c53b79d564ba17c4a69de78bd917ef80 (patch)
treebe14f91f7200da0b731f60fe0c53398efe83345b /crypto/src/math/raw/Nat256.cs
parentRefactor Equals/GetHashCode in X509 objects (diff)
downloadBouncyCastle.NET-ed25519-b033b509c53b79d564ba17c4a69de78bd917ef80.tar.xz
Updates to raw math classes from bc-java
Diffstat (limited to '')
-rw-r--r--crypto/src/math/raw/Nat256.cs14
1 files changed, 8 insertions, 6 deletions
diff --git a/crypto/src/math/raw/Nat256.cs b/crypto/src/math/raw/Nat256.cs
index 2be03d642..5c473c405 100644
--- a/crypto/src/math/raw/Nat256.cs
+++ b/crypto/src/math/raw/Nat256.cs
@@ -632,9 +632,10 @@ namespace Org.BouncyCastle.Math.Raw
                 c += x_i * y_7 + zz[i + 7];
                 zz[i + 7] = (uint)c;
                 c >>= 32;
-                c += zc + zz[i + 8];
-                zz[i + 8] = (uint)c;
-                zc = c >> 32;
+
+                zc += c + zz[i + 8];
+                zz[i + 8] = (uint)zc;
+                zc >>= 32;
             }
             return (uint)zc;
         }
@@ -678,9 +679,10 @@ namespace Org.BouncyCastle.Math.Raw
                 c += x_i * y_7 + zz[zzOff + 7];
                 zz[zzOff + 7] = (uint)c;
                 c >>= 32;
-                c += zc + zz[zzOff + 8];
-                zz[zzOff + 8] = (uint)c;
-                zc = c >> 32;
+
+                zc += c + zz[zzOff + 8];
+                zz[zzOff + 8] = (uint)zc;
+                zc >>= 32;
                 ++zzOff;
             }
             return (uint)zc;