Re: RFR: 8294731: Improve multiplicative inverse for secp256r1 implementation [v6]

2022-11-15 Thread Ferenc Rakoczi
On Sat, 12 Nov 2022 18:52:59 GMT, Xue-Lei Andrew Fan wrote: >> Hi, >> >> May I have this patch reviewed? >> >> This is one of a few steps to improve the EC performance. The multiplicative >> inverse implementation could be improved for better performance. >> >> For secp256r1 prime p, the cur

Re: RFR: 8294731: Improve multiplicative inverse for secp256r1 implementation [v2]

2022-11-13 Thread Xue-Lei Andrew Fan
On Wed, 2 Nov 2022 14:44:30 GMT, Ferenc Rakoczi wrote: >>> ... you only have one chance to measure, so cannot average out noise ... >> >> There are cases that one chance is enough to place an attack. We normally >> don't discuss vulnerability details in public, please send me an email in >> p

Re: RFR: 8294731: Improve multiplicative inverse for secp256r1 implementation [v6]

2022-11-12 Thread Xue-Lei Andrew Fan
> Hi, > > May I have this patch reviewed? > > This is one of a few steps to improve the EC performance. The multiplicative > inverse implementation could be improved for better performance. > > For secp256r1 prime p, the current multiplicative inverse impl needs 256 > square and 128 multipli

Re: RFR: 8294731: Improve multiplicative inverse for secp256r1 implementation [v5]

2022-11-12 Thread Xue-Lei Andrew Fan
> Hi, > > May I have this patch reviewed? > > This is one of a few steps to improve the EC performance. The multiplicative > inverse implementation could be improved for better performance. > > For secp256r1 prime p, the current multiplicative inverse impl needs 256 > square and 128 multipli

Re: RFR: 8294731: Improve multiplicative inverse for secp256r1 implementation [v4]

2022-11-02 Thread Xue-Lei Andrew Fan
> Hi, > > May I have this patch reviewed? > > This is one of a few steps to improve the EC performance. The multiplicative > inverse implementation could be improved for better performance. > > For secp256r1 prime p, the current multiplicative inverse impl needs 256 > square and 128 multipli

Re: RFR: 8294731: Improve multiplicative inverse for secp256r1 implementation [v3]

2022-11-02 Thread Xue-Lei Andrew Fan
On Wed, 2 Nov 2022 14:35:20 GMT, Ferenc Rakoczi wrote: >> Xue-Lei Andrew Fan has updated the pull request incrementally with one >> additional commit since the last revision: >> >> more improvement > > src/java.base/share/classes/sun/security/util/math/IntegerModuloP.java line > 410: > >> 4

Re: RFR: 8294731: Improve multiplicative inverse for secp256r1 implementation [v2]

2022-11-02 Thread Xue-Lei Andrew Fan
On Wed, 2 Nov 2022 14:44:30 GMT, Ferenc Rakoczi wrote: > > > ... you only have one chance to measure, so cannot average out noise ... > > > > > > There are cases that one chance is enough to place an attack. We normally > > don't discuss vulnerability details in public, please send me an email

Re: RFR: 8294731: Improve multiplicative inverse for secp256r1 implementation [v2]

2022-11-02 Thread Ferenc Rakoczi
On Mon, 31 Oct 2022 17:19:21 GMT, Xue-Lei Andrew Fan wrote: > > ... you only have one chance to measure, so cannot average out noise ... > > There are cases that one chance is enough to place an attack. We normally > don't discuss vulnerability details in public, please send me an email in > p

Re: RFR: 8294731: Improve multiplicative inverse for secp256r1 implementation [v3]

2022-11-02 Thread Ferenc Rakoczi
On Sat, 8 Oct 2022 15:34:57 GMT, Xue-Lei Andrew Fan wrote: >> Hi, >> >> May I have this patch reviewed? >> >> This is one of a few steps to improve the EC performance. The multiplicative >> inverse implementation could be improved for better performance. >> >> For secp256r1 prime p, the curr

Re: RFR: 8294731: Improve multiplicative inverse for secp256r1 implementation [v2]

2022-10-31 Thread Xue-Lei Andrew Fan
On Mon, 31 Oct 2022 17:19:21 GMT, Xue-Lei Andrew Fan wrote: >>> BigInteger exponentiation time also depends on also depends on the base; >>> quick benchmark: `BigInteger.ONE.modPow(mod.subtract(BigInteger.TWO), mod)` >>> vs `BigInteger.TWO.modPow(mod.subtract(BigInteger.TWO), mod)`: >>> >>> ``

Re: RFR: 8294731: Improve multiplicative inverse for secp256r1 implementation [v2]

2022-10-31 Thread Xue-Lei Andrew Fan
On Mon, 10 Oct 2022 08:21:57 GMT, Ferenc Rakoczi wrote: > ... you only have one chance to measure, so cannot average out noise ... There are cases that one chance is enough to place an attack. We normally don't discuss vulnerability details in public, please send me an email in private if mor

Re: RFR: 8294731: Improve multiplicative inverse for secp256r1 implementation [v3]

2022-10-31 Thread Weijun Wang
On Mon, 31 Oct 2022 14:58:02 GMT, Xue-Lei Andrew Fan wrote: >> Xue-Lei Andrew Fan has updated the pull request incrementally with one >> additional commit since the last revision: >> >> more improvement > > Reviewer approval is required. Anyone has cycle? Thanks! Hi @XueleiFan, can you wai

Re: RFR: 8294731: Improve multiplicative inverse for secp256r1 implementation [v3]

2022-10-31 Thread John Jiang
On Sat, 8 Oct 2022 15:34:57 GMT, Xue-Lei Andrew Fan wrote: >> Hi, >> >> May I have this patch reviewed? >> >> This is one of a few steps to improve the EC performance. The multiplicative >> inverse implementation could be improved for better performance. >> >> For secp256r1 prime p, the curr

Re: RFR: 8294731: Improve multiplicative inverse for secp256r1 implementation [v3]

2022-10-31 Thread Xue-Lei Andrew Fan
On Sat, 8 Oct 2022 15:34:57 GMT, Xue-Lei Andrew Fan wrote: >> Hi, >> >> May I have this patch reviewed? >> >> This is one of a few steps to improve the EC performance. The multiplicative >> inverse implementation could be improved for better performance. >> >> For secp256r1 prime p, the curr

Re: RFR: 8294731: Improve multiplicative inverse for secp256r1 implementation [v3]

2022-10-10 Thread Daniel Jeliński
On Sat, 8 Oct 2022 15:34:57 GMT, Xue-Lei Andrew Fan wrote: >> Hi, >> >> May I have this patch reviewed? >> >> This is one of a few steps to improve the EC performance. The multiplicative >> inverse implementation could be improved for better performance. >> >> For secp256r1 prime p, the curr

Re: RFR: 8294731: Improve multiplicative inverse for secp256r1 implementation [v2]

2022-10-10 Thread Ferenc Rakoczi
On Fri, 7 Oct 2022 16:31:13 GMT, Daniel Jeliński wrote: > BigInteger exponentiation time also depends on also depends on the base; > quick benchmark: `BigInteger.ONE.modPow(mod.subtract(BigInteger.TWO), mod)` > vs `BigInteger.TWO.modPow(mod.subtract(BigInteger.TWO), mod)`: > > ``` > Benchmark

Re: RFR: 8294731: Improve multiplicative inverse for secp256r1 implementation [v2]

2022-10-08 Thread Xue-Lei Andrew Fan
On Thu, 6 Oct 2022 19:35:09 GMT, Daniel Jeliński wrote: > could you also try using precomputed powers of t between 0-15? similar to > what we do in > [ECOperations.multiply](https://github.com/openjdk/jdk/blob/2ae8e3118385bdf93c50bca550334734b69bc2b6/src/jdk.crypto.ec/share/classes/sun/security

Re: RFR: 8294731: Improve multiplicative inverse for secp256r1 implementation [v3]

2022-10-08 Thread Xue-Lei Andrew Fan
> Hi, > > May I have this patch reviewed? > > This is one of a few steps to improve the EC performance. The multiplicative > inverse implementation could be improved for better performance. > > For secp256r1 prime p, the current multiplicative inverse impl needs 256 > square and 128 multipli

Re: RFR: 8294731: Improve multiplicative inverse for secp256r1 implementation [v2]

2022-10-07 Thread Xue-Lei Andrew Fan
On Thu, 6 Oct 2022 18:33:51 GMT, Xue-Lei Andrew Fan wrote: >> It seems to me the scalar multiplication enhancement should be done first, >> or maybe integrated with this fix. >> Do you have a bug number for the scalar multiplication enhancement? > >> It seems to me the scalar multiplication enha

Re: RFR: 8294731: Improve multiplicative inverse for secp256r1 implementation [v2]

2022-10-07 Thread Daniel Jeliński
On Wed, 5 Oct 2022 17:37:25 GMT, Xue-Lei Andrew Fan wrote: >> Hi, >> >> May I have this patch reviewed? >> >> This is one of a few steps to improve the EC performance. The multiplicative >> inverse implementation could be improved for better performance. >> >> For secp256r1 prime p, the curr

Re: RFR: 8294731: Improve multiplicative inverse for secp256r1 implementation [v2]

2022-10-07 Thread Ferenc Rakoczi
On Fri, 7 Oct 2022 15:37:24 GMT, Daniel Jeliński wrote: >>> It seems to me the scalar multiplication enhancement should be done first, >>> or maybe integrated with this fix. Do you have a bug number for the scalar >>> multiplication enhancement? >> >> I did not file the scalar multiplication e

Re: RFR: 8294731: Improve multiplicative inverse for secp256r1 implementation [v2]

2022-10-07 Thread Daniel Jeliński
On Thu, 6 Oct 2022 18:33:51 GMT, Xue-Lei Andrew Fan wrote: >> It seems to me the scalar multiplication enhancement should be done first, >> or maybe integrated with this fix. >> Do you have a bug number for the scalar multiplication enhancement? > >> It seems to me the scalar multiplication enha

Re: RFR: 8294731: Improve multiplicative inverse for secp256r1 implementation [v2]

2022-10-07 Thread Ferenc Rakoczi
On Wed, 5 Oct 2022 17:37:25 GMT, Xue-Lei Andrew Fan wrote: >> Hi, >> >> May I have this patch reviewed? >> >> This is one of a few steps to improve the EC performance. The multiplicative >> inverse implementation could be improved for better performance. >> >> For secp256r1 prime p, the curr

Re: RFR: 8294731: Improve multiplicative inverse for secp256r1 implementation [v2]

2022-10-06 Thread Daniel Jeliński
On Wed, 5 Oct 2022 17:37:25 GMT, Xue-Lei Andrew Fan wrote: >> Hi, >> >> May I have this patch reviewed? >> >> This is one of a few steps to improve the EC performance. The multiplicative >> inverse implementation could be improved for better performance. >> >> For secp256r1 prime p, the curr

Re: RFR: 8294731: Improve multiplicative inverse for secp256r1 implementation [v2]

2022-10-06 Thread Daniel Jeliński
On Wed, 5 Oct 2022 17:37:25 GMT, Xue-Lei Andrew Fan wrote: >> Hi, >> >> May I have this patch reviewed? >> >> This is one of a few steps to improve the EC performance. The multiplicative >> inverse implementation could be improved for better performance. >> >> For secp256r1 prime p, the curr

Re: RFR: 8294731: Improve multiplicative inverse for secp256r1 implementation [v2]

2022-10-06 Thread Xue-Lei Andrew Fan
On Thu, 6 Oct 2022 16:11:17 GMT, Mark Powers wrote: > It seems to me the scalar multiplication enhancement should be done first, or > maybe integrated with this fix. Do you have a bug number for the scalar > multiplication enhancement? I did not file the scalar multiplication enhancement in JB

Re: RFR: 8294731: Improve multiplicative inverse for secp256r1 implementation [v2]

2022-10-06 Thread Mark Powers
On Wed, 5 Oct 2022 17:37:25 GMT, Xue-Lei Andrew Fan wrote: >> Hi, >> >> May I have this patch reviewed? >> >> This is one of a few steps to improve the EC performance. The multiplicative >> inverse implementation could be improved for better performance. >> >> For secp256r1 prime p, the curr

Re: RFR: 8294731: Improve multiplicative inverse for secp256r1 implementation [v2]

2022-10-05 Thread Xue-Lei Andrew Fan
> Hi, > > May I have this patch reviewed? > > This is one of a few steps to improve the EC performance. The multiplicative > inverse implementation could be improved for better performance. > > For secp256r1 prime p, the current multiplicative inverse impl needs 256 > square and 128 multipli

RFR: 8294731: Improve multiplicative inverse for secp256r1 implementation

2022-10-04 Thread Xue-Lei Andrew Fan
Hi, May I have this patch reviewed? This is one of a few steps to improve the EC performance. The multiplicative inverse implementation could be improved for better performance. For secp256r1 prime p, the current multiplicative inverse impl needs 256 square and 128 multiplication. With the