summary refs log tree commit diff
path: root/crypto/src
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2020-04-05 18:41:24 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2020-04-05 18:41:24 +0700
commit04443c312ab6c592449d77d7fb5753bd0cf3324d (patch)
treeade69637449cb0237e08c2f0b89c7684de9a07a9 /crypto/src
parentAdd guard in OID parsing (diff)
downloadBouncyCastle.NET-ed25519-04443c312ab6c592449d77d7fb5753bd0cf3324d.tar.xz
added argument check for bit block size
Diffstat (limited to 'crypto/src')
-rw-r--r--crypto/src/crypto/modes/CfbBlockCipher.cs3
1 files changed, 3 insertions, 0 deletions
diff --git a/crypto/src/crypto/modes/CfbBlockCipher.cs b/crypto/src/crypto/modes/CfbBlockCipher.cs
index 433716535..ed0be407a 100644
--- a/crypto/src/crypto/modes/CfbBlockCipher.cs
+++ b/crypto/src/crypto/modes/CfbBlockCipher.cs
@@ -29,6 +29,9 @@ namespace Org.BouncyCastle.Crypto.Modes
             IBlockCipher cipher,
             int          bitBlockSize)
         {
+            if (bitBlockSize < 8 || (bitBlockSize & 7) != 0)
+                throw new ArgumentException("CFB" + bitBlockSize + " not supported", "bitBlockSize");
+
             this.cipher = cipher;
             this.blockSize = bitBlockSize / 8;
             this.IV = new byte[cipher.GetBlockSize()];