From fcbb6956ca47b38549143f289d017485217c7a36 Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Sat, 25 Jan 2014 20:44:18 +0700 Subject: Add 0 guard in ModInverse --- crypto/src/math/ec/LongArray.cs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'crypto/src') 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; -- cgit 1.5.1