Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix over-zeroing of destination buffer with PaddingMode.Zeros
This addresses two issues with how zero padding is handled. The first is performance. When applying zero padding, we were clearing the entire destination, then copying the plaintext over it. We were zeroing more data than required, the only data that needed to be zeroed is where the zero padding is applied. The second is in the case of overlapping buffers for the plaintext and ciphertext. However, this cannot happen currently since we always ensure the destination buffer does not overlap the input buffer. If overlapping is permitted in a future change, this would clear the plaintext, not just where padding is required.
- Loading branch information