RFR: 8286389: Address possibly lossy conversions in jdk.crypto.ec

Ryan Ernst duke at openjdk.org
Fri Jun 24 14:38:49 UTC 2022


On Tue, 21 Jun 2022 16:48:23 GMT, Xue-Lei Andrew Fan <xuelei at openjdk.org> wrote:

>> Applied required casts in jdk.crypto.ec for the upcoming warning.
>> Verified by cherry-picking @asotona's patch.
>
> src/jdk.crypto.ec/share/classes/sun/security/ec/XDHPublicKeyImpl.java line 79:
> 
>> 77:         int bitsMod8 = params.getBits() % 8;
>> 78:         if (bitsMod8 != 0) {
>> 79:             byte mask = (byte) ((1 << bitsMod8) - 1);
> 
> I may not insert a whitespace after the "(byte)" conversion.  Similar to following update.  Otherwise, looks good to me.

I followed the cast style in `EdDSAOperations.java`. Should I change this one and leave the other, change both, or leave these as is to be consistent? I don't particularly mind which way it is, I'll do whatever you suggest.

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

PR: https://git.openjdk.org/jdk/pull/9203


More information about the security-dev mailing list