Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
-
None
-
Reviewed
Description
public static void incrementIv(byte[] iv, int v) { int length = iv.length; boolean carry = true; // TODO: Optimize for v > 1, e.g. 16, 32 do { for (int i = 0; i < length; i++) { if (carry) { iv[i] = (byte) ((iv[i] + 1) & 0xFF); carry = 0 == iv[i]; } else { break; } } v--; } while (v > 0); }
The carry flag is outside the while loop and the inner loop check the carry value is true, so that when it was set to false, it will make the rest iterations busy spinning.
And the logic becomes whatever the v is, the IV will be incremented by (1 or 2). As the description in todo, this function should support increment value > 1. So that this is not what we expect I think.
Attachments
Issue Links
- relates to
-
HBASE-26619 Backport HBASE-26613 to branch-1
- Resolved
- links to