On Wed, 5 Jun 2024 18:27:11 GMT, Valerie Peng <valer...@openjdk.org> wrote:

>> The code does not assume that `outOfs = 0` but that the content of `out` 
>> (between 0 and `outOfs`) is previously generated output of a multi-part 
>> operation (not the whole output but one that is multiple of the block size). 
>> `outOfs + k` is an offset that we need to know and pass to 
>> `convertCTSVariant` for the `out` slicing. @franferrax , do you see possible 
>> to determine the penultimate block size from `k` only? (i.e. `int pad = k % 
>> blockSize;`) This would be more resilient for handling a user-supplied value.
>
> I am not sure that we can make the assumption `the content of out (between 0 
> and outOfs) is previously generated output of a multi-part operation`. It's 
> possible that the output buffer starts at a non-zero offset for storing the 
> encrypt/decrypted data.

Yes, that's why I asked @franferrax if we could change it to something like 
`int pad = k % blockSize;`. We will take that approach.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/18898#discussion_r1628299169

Reply via email to