From 04443c312ab6c592449d77d7fb5753bd0cf3324d Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Sun, 5 Apr 2020 18:41:24 +0700 Subject: added argument check for bit block size --- crypto/src/crypto/modes/CfbBlockCipher.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'crypto/src') 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()]; -- cgit 1.4.1