RFR: 8271745: Correct block size for KW, KWP mode and use fixed IV for KWP mode for SunJCE
Valerie Peng
valeriep at openjdk.java.net
Wed Sep 1 02:32:48 UTC 2021
On Tue, 31 Aug 2021 12:05:48 GMT, Sean Mullan <mullan at openjdk.org> wrote:
>> Line 186 is correct in that the underlying Cipher block size must be 128-bit. However, the KW/KWP processing affected the input size requirement into 8-byte blocks, thus the overall cipher block size is now 8 instead of 16 bytes.
>
> So the block size is always 8 even when there is no padding?
Yes, with KW (no pad), data must be in multiples of 8. When data does not meet this size requirement, an external padding scheme such as PKCS5/7 padding is needed to pad the data to multiples of 8 in order for KW mode to process the data.
As for KWP mode, it internally pads the data to multiples of 8 before starting the internal processing. Thus, no external padding is needed. Are you asking if 8 should be returned for KWP mode due to its internal padding? KWP is like a variant of KW, so it seems to me that it should return the same block size as KW.
-------------
PR: https://git.openjdk.java.net/jdk/pull/5236
More information about the security-dev
mailing list