summary refs log tree commit diff
path: root/crypto/src
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2014-01-25 20:44:18 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2014-01-25 20:44:18 +0700
commitfcbb6956ca47b38549143f289d017485217c7a36 (patch)
treeabddd70f8a93540cea79b892f3fb2e177ca5a86c /crypto/src
parentImplement homogeneous and lambda-projective coordinate systems in F2m curves (diff)
downloadBouncyCastle.NET-ed25519-fcbb6956ca47b38549143f289d017485217c7a36.tar.xz
Add 0 guard in ModInverse
Diffstat (limited to 'crypto/src')
-rw-r--r--crypto/src/math/ec/LongArray.cs4
1 files changed, 4 insertions, 0 deletions
diff --git a/crypto/src/math/ec/LongArray.cs b/crypto/src/math/ec/LongArray.cs
index d694f0cf0..a863c0a61 100644
--- a/crypto/src/math/ec/LongArray.cs
+++ b/crypto/src/math/ec/LongArray.cs
@@ -1879,6 +1879,10 @@ namespace Org.BouncyCastle.Math.EC
              * Output: a(z)^(-1) mod f(z)
              */
             int uzDegree = Degree();
+            if (uzDegree == 0)
+            {
+                throw new InvalidOperationException();
+            }
             if (uzDegree == 1)
             {
                 return this;