From b197150075a4bbbbf6bab1b2ba3ab91c908fe0f0 Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Wed, 31 Aug 2022 01:42:49 +0700 Subject: Fix exceptions --- crypto/src/crypto/modes/CtsBlockCipher.cs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/crypto/src/crypto/modes/CtsBlockCipher.cs b/crypto/src/crypto/modes/CtsBlockCipher.cs index ff37844ab..b1b00c5fa 100644 --- a/crypto/src/crypto/modes/CtsBlockCipher.cs +++ b/crypto/src/crypto/modes/CtsBlockCipher.cs @@ -121,19 +121,14 @@ namespace Org.BouncyCastle.Crypto.Modes int outOff) { if (length < 0) - { - throw new ArgumentException("Can't have a negative input outLength!"); - } + throw new ArgumentException("Can't have a negative input length!"); int blockSize = GetBlockSize(); int outLength = GetUpdateOutputSize(length); if (outLength > 0) { - if ((outOff + outLength) > output.Length) - { - throw new DataLengthException("output buffer too short"); - } + Check.OutputLength(output, outOff, outLength, "output buffer too short"); } int resultLen = 0; -- cgit 1.4.1