cisco / libsrtp

Library for SRTP (Secure Realtime Transport Protocol)
Other
1.2k stars 472 forks source link

Count blocks instead of bytes in AES-ICM limit computation #551

Closed bifurcation closed 2 years ago

bifurcation commented 3 years ago

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