corretto / amazon-corretto-crypto-provider

The Amazon Corretto Crypto Provider is a collection of high-performance cryptographic implementations exposed via standard JCA/JCE interfaces.
Apache License 2.0
238 stars 56 forks source link

Fix ByteBuffer offset calculation for AES/CBC/NoPadding #412

Closed bmathiske closed 2 weeks ago

bmathiske commented 2 weeks ago

411

The shim buffer implementation was missing the array offset into its source byte buffer, which needs to be added to the source byte buffer's position to obtain the correct effective position in the underlying byte array. The added tests checks that this works for ByteBuffer slices with aligned and unaligned offsets.

This contribution was made possible by Guillaume Rose and Aline Bousquet at Apple. They found the bug and created a reproducer program, on which the submitted unit tests are based.