mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 14:24:46 +02:00
8220165: Encryption using GCM results in RuntimeException- input length out of bound
Reviewed-by: valeriep
This commit is contained in:
parent
6d12ffec19
commit
5250aaafdb
2 changed files with 231 additions and 4 deletions
|
@ -399,7 +399,6 @@ final class GaloisCounterMode extends FeedbackCipher {
|
|||
if (len > TRIGGERLEN) {
|
||||
int i = 0;
|
||||
int tlen; // incremental lengths
|
||||
// 96bit CTR x86 intrinsic
|
||||
final int plen = AES_BLOCK_SIZE * 6;
|
||||
// arbitrary formula to aid intrinsic without reaching buffer end
|
||||
final int count = len / 1024;
|
||||
|
@ -419,11 +418,11 @@ final class GaloisCounterMode extends FeedbackCipher {
|
|||
gctrPAndC.doFinal(in, inOfs, ilen, out, outOfs);
|
||||
processed += ilen;
|
||||
|
||||
int lastLen = len % AES_BLOCK_SIZE;
|
||||
int lastLen = ilen % AES_BLOCK_SIZE;
|
||||
if (lastLen != 0) {
|
||||
ghashAllToS.update(ct, ctOfs, len - lastLen);
|
||||
ghashAllToS.update(ct, ctOfs, ilen - lastLen);
|
||||
ghashAllToS.update(
|
||||
expandToOneBlock(ct, (ctOfs + len - lastLen), lastLen));
|
||||
expandToOneBlock(ct, (ctOfs + ilen - lastLen), lastLen));
|
||||
} else {
|
||||
ghashAllToS.update(ct, ctOfs, ilen);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue