summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2022-08-31 01:42:49 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2022-08-31 01:42:49 +0700
commitb197150075a4bbbbf6bab1b2ba3ab91c908fe0f0 (patch)
tree73a0f78f70d86f6c95db76b36d620b3253546eeb
parentSpan-based variant for IAeadCipher.DoFinal (diff)
downloadBouncyCastle.NET-ed25519-b197150075a4bbbbf6bab1b2ba3ab91c908fe0f0.tar.xz
Fix exceptions
-rw-r--r--crypto/src/crypto/modes/CtsBlockCipher.cs9
1 files 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;