As noted in #509, the current AES-ICM implementation incorrectly computes the number of bytes it can encrypt. The block counter counts in units of 16-byte AES blocks, but it is added to the number bytes to be encrypted. This PR changes the computation to compute how many new blocks of keystream are required, and compare that with the counter to ensure that enough counter space remains.
As noted in #509, the current AES-ICM implementation incorrectly computes the number of bytes it can encrypt. The block counter counts in units of 16-byte AES blocks, but it is added to the number bytes to be encrypted. This PR changes the computation to compute how many new blocks of keystream are required, and compare that with the counter to ensure that enough counter space remains.
Fixes #509