summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2017-06-10 20:28:52 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2017-06-10 20:28:52 +0700
commitc4794df16c0376050a9aff613d7b2327e9087f65 (patch)
tree693adc27715cfdb3ead3932ea68bf6b5c9e054ba
parentStop decoding exceptions escaping from GetDecoderStream (diff)
downloadBouncyCastle.NET-ed25519-c4794df16c0376050a9aff613d7b2327e9087f65.tar.xz
Added byte[] return when macBlock not set.
-rw-r--r--crypto/src/crypto/modes/OCBBlockCipher.cs4
1 files changed, 3 insertions, 1 deletions
diff --git a/crypto/src/crypto/modes/OCBBlockCipher.cs b/crypto/src/crypto/modes/OCBBlockCipher.cs
index e7dc466e6..91fdfff18 100644
--- a/crypto/src/crypto/modes/OCBBlockCipher.cs
+++ b/crypto/src/crypto/modes/OCBBlockCipher.cs
@@ -237,7 +237,9 @@ namespace Org.BouncyCastle.Crypto.Modes
 
         public virtual byte[] GetMac()
         {
-            return Arrays.Clone(macBlock);
+            return macBlock == null
+                ? new byte[macSize]
+                : Arrays.Clone(macBlock);
         }
 
         public virtual int GetOutputSize(int len)