Hi Maxim, why do you think that data size can be divided to cipher block
size with 0 remainder.

I used to think that page size 4096 is always divisible by a usual block
cipher block size, e.g 32, 16 or 8 bytes

чт, 31 янв. 2019 г. в 13:11, Максим Степачёв <maksim.stepac...@gmail.com>:

> Hi, I have been trying to solve a problem with calculation size for
> encryption mode, it's ticket IGNITE-11129. But I found an additional place
> for wrong behavior. I'm confused, Is it fine or wrong? Look at
> *KeystoreEncryptionSpi#encryptedSize*, the result calculation works as
>
> (dataSize / BLOCK_SZ + cntBlocks) * BLOCK_SZ;
>
> But we don't have a guarantee that dataSize is multiple of BLOCK_SZ.
> Should we use this code:
>
> ((dataSize + BLOCK_SZ - 1) / BLOCK_SZ + cntBlocks) * BLOCK_SZ;
>
> If yes, I'll fix it.
>

Reply via email to