RFR: 8295010: Reduce if required in EC limbs operations [v5]
Daniel Jeliński
djelinski at openjdk.org
Tue Nov 22 08:43:26 UTC 2022
On Mon, 21 Nov 2022 16:19:00 GMT, Xue-Lei Andrew Fan <xuelei at openjdk.org> wrote:
>> 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?
Apologies, I was looking at the wrong branch, didn't notice `setProduct(SmallValue)` also does a reduce if required.
-------------
PR: https://git.openjdk.org/jdk/pull/10624
More information about the security-dev
mailing list