summary refs log tree commit diff
path: root/crypto/src
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2015-11-10 21:54:45 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2015-11-10 21:54:45 +0700
commit87e1351939f4f5f03770a4bb4a261ecdbc10545f (patch)
tree555a1dd836163c7b39940f2a600595ea71b2e814 /crypto/src
parentAddress various compiler warnings (diff)
downloadBouncyCastle.NET-ed25519-87e1351939f4f5f03770a4bb4a261ecdbc10545f.tar.xz
Add sanity check on input length
Diffstat (limited to 'crypto/src')
-rw-r--r--crypto/src/crypto/engines/IesEngine.cs4
1 files changed, 4 insertions, 0 deletions
diff --git a/crypto/src/crypto/engines/IesEngine.cs b/crypto/src/crypto/engines/IesEngine.cs
index a2004a9d6..9139f3ffc 100644
--- a/crypto/src/crypto/engines/IesEngine.cs
+++ b/crypto/src/crypto/engines/IesEngine.cs
@@ -97,6 +97,10 @@ namespace Org.BouncyCastle.Crypto.Engines
 
             kdf.Init(kParam);
 
+            // Ensure that the length of the input is greater than the MAC in bytes
+            if (inLen <= mac.GetMacSize())
+                throw new InvalidCipherTextException("Length of input must be greater than the MAC");
+
             inLen -= mac.GetMacSize();
 
             if (cipher == null)     // stream mode