RFR: 8026976: ECParameters, Point does not match field size

Xue-Lei Andrew Fan xuelei at openjdk.java.net
Wed Dec 2 18:09:00 UTC 2020


On Wed, 2 Dec 2020 17:49:10 GMT, Anthony Scarpino <ascarpino at openjdk.org> wrote:

>> src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11ECKeyFactory.java line 303:
>> 
>>> 301:                 } else {
>>> 302:                     point = decodePoint(attributes[0].getByteArray(), params.getCurve());
>>> 303:                 }
>> 
>> You could save a "!" operation in 299 if switch line 302 and line 300.
>
> I only used "!" for consistency with existing usage in P11Key.java:1080.    Is there a reason to avoid "!" other than maybe readability?

Save a operation could get a little bit performance.  Comparing to "if (!a)", "if (a)" is easier to read to me, and save me a cycle to compute the "!".  Anyway, not a big concern of mine, you can leave it as is if you prefer the "if (!a)" style.

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

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



More information about the security-dev mailing list