diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2014-06-21 09:34:32 +0400 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2014-06-21 09:34:32 +0400 |
commit | 1b2b60b4b0993c7c7a584010e0bf3f46264ca1a5 (patch) | |
tree | a4b8cc325f917661d7bb3fdb0821d4afec1bd3d0 /core/src/main/java/org/bouncycastle | |
parent | 1d4caab51e298a21a56aea817815c1a63947e1f7 (diff) |
Throw exception if no key specified for initial init
Diffstat (limited to 'core/src/main/java/org/bouncycastle')
-rw-r--r-- | core/src/main/java/org/bouncycastle/crypto/modes/GCMBlockCipher.java | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/core/src/main/java/org/bouncycastle/crypto/modes/GCMBlockCipher.java b/core/src/main/java/org/bouncycastle/crypto/modes/GCMBlockCipher.java index 0d458c46..024eb860 100644 --- a/core/src/main/java/org/bouncycastle/crypto/modes/GCMBlockCipher.java +++ b/core/src/main/java/org/bouncycastle/crypto/modes/GCMBlockCipher.java @@ -147,6 +147,10 @@ public class GCMBlockCipher multiplier.init(H); exp = null; } + else if (this.H == null) + { + throw new IllegalArgumentException("Key must be specified in initial init"); + } this.J0 = new byte[BLOCK_SIZE]; @@ -191,7 +195,7 @@ public class GCMBlockCipher if (forEncryption) { - return totalData + macSize; + return totalData + macSize; } return totalData < macSize ? 0 : totalData - macSize; |