RFR: 8248268: Support KWP in addition to KW [v4]

Valerie Peng valeriep at openjdk.java.net
Tue Apr 13 04:47:00 UTC 2021


On Sat, 27 Mar 2021 03:54:24 GMT, Greg Rubin <github.com+829871+SalusaSecondus at openjdk.org> wrote:

>> Valerie Peng has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Refactor code to reduce code duplication
>>   Address review comments
>>   Add more test vectors
>
> src/java.base/share/classes/com/sun/crypto/provider/AESKeyWrapPadded.java line 78:
> 
>> 76:         for (int k = 5; k < SEMI_BLKSIZE; k++) {
>> 77:             if (outLen != 0) {
>> 78:                 outLen <<= SEMI_BLKSIZE;
> 
> While technically, this is correct (as it is shifting by 8 bits), it is pure coincidence that `SEMI_BLKSIZE` (8 bytes) happens to have the name integer value as the number of bits in one byte. It took me more reads than I care to admit to understand why this worked. Could we just replace this one with an `8` as it is clearer and more accurate?

Yes, makes sense. I will update it.

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

PR: https://git.openjdk.java.net/jdk/pull/2404



More information about the security-dev mailing list