RFR: 8295010: Reduce if required in EC limbs operations [v5]

Xue-Lei Andrew Fan xuelei at openjdk.org
Mon Nov 21 16:21:30 UTC 2022


On Mon, 21 Nov 2022 07:41:12 GMT, Daniel Jeliński <djelinski at openjdk.org> wrote:

>> Xue-Lei Andrew Fan has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   remove duplicated bench test
>
> src/java.base/share/classes/sun/security/util/math/intpoly/IntegerPolynomial.java line 561:
> 
>> 559:             // Reduce if required.
>> 560:             // if (numAdds >= maxAdds) {
>> 561:             if (numAdds > 32 - bitsPerLimb) {
> 
> if we allow this number of additions, `setProduct(SmallValue)` might overflow in the future. Currently it's safe - we only create a limited set of SmallValues, and they are all small enough to avoid this risk.
> `getSmallValue` allows numbers up to `bitsPerLimb` bits. I think we can adjust that.

Sorry, I did not get the ideas.  Did you meant to adjust the implementation of getSmallValue to allow 32 bits int value?

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

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



More information about the security-dev mailing list