Re: [PATCH 3/3] GOST curves generate larger overflows in mod arithmetics

2019-05-12 Thread Dmitry Eremin-Solenikov
Hi, > > For now I'm running ecc-mul-a-test and ecc-mul-g-test in a loop without any > > errors. > > To make running in a loop useful, you need to add random seeding, see > ecc-mod-test.c for an example to how to do it, enabled by the > NETTLE_TEST_SEED environment variable. Used like > > while

Re: [PATCH 3/3] GOST curves generate larger overflows in mod arithmetics

2019-05-12 Thread Niels Möller
Dmitry Eremin-Solenikov writes: > This patch makes things work for me. Is it only ecc_mod_submul_1 that you need to change? It's used via the ecc_modp_submul_1 macro. > Does it stand a chance to be applied? To accept the patch, I'd like to understand the mathematics and document what's

Re: [PATCH 3/3] GOST curves generate larger overflows in mod arithmetics

2019-05-12 Thread Dmitry Eremin-Solenikov
сб, 11 мая 2019 г. в 21:55, Niels Möller : > > Dmitry Eremin-Solenikov writes: > > >> If p is close to B^size / 2, then I think a reduction like > > > > Yes, it is. > > > > As an overflow happens in low level code, do you suggest > > duplicating ecc-dup-jj/ecc-add-jja/ecc-add-jjj for GOST curves?

Re: [PATCH 3/3] GOST curves generate larger overflows in mod arithmetics

2019-05-11 Thread Niels Möller
Dmitry Eremin-Solenikov writes: >> If p is close to B^size / 2, then I think a reduction like > > Yes, it is. > > As an overflow happens in low level code, do you suggest > duplicating ecc-dup-jj/ecc-add-jja/ecc-add-jjj for GOST curves? I'd prefer not to duplicate the point functions. Could

Re: [PATCH 3/3] GOST curves generate larger overflows in mod arithmetics

2019-05-11 Thread Niels Möller
Dmitry Eremin-Solenikov writes: >> Is it the condition b < B^size / p that is not valid for the GOST >> curves? What are the problematic values of b and p? > > I did not try debugging maths part of this issue. > Basically you can apply first two patches and then observe asserts failing > when

Re: [PATCH 3/3] GOST curves generate larger overflows in mod arithmetics

2019-05-11 Thread Dmitry Eremin-Solenikov
Hello, сб, 11 мая 2019 г. в 11:26, Niels Möller : > > Dmitry Eremin-Solenikov writes: > > > Signed-off-by: Dmitry Eremin-Solenikov > > --- > > ecc-mod-arith.c | 30 ++ > > 1 file changed, 18 insertions(+), 12 deletions(-) > > > > diff --git a/ecc-mod-arith.c

Re: [PATCH 3/3] GOST curves generate larger overflows in mod arithmetics

2019-05-11 Thread Niels Möller
Dmitry Eremin-Solenikov writes: > Signed-off-by: Dmitry Eremin-Solenikov > --- > ecc-mod-arith.c | 30 ++ > 1 file changed, 18 insertions(+), 12 deletions(-) > > diff --git a/ecc-mod-arith.c b/ecc-mod-arith.c > index f2e47f6747c1..571680a98dc3 100644 > ---

[PATCH 3/3] GOST curves generate larger overflows in mod arithmetics

2019-05-08 Thread Dmitry Eremin-Solenikov
Signed-off-by: Dmitry Eremin-Solenikov --- ecc-mod-arith.c | 30 ++ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/ecc-mod-arith.c b/ecc-mod-arith.c index f2e47f6747c1..571680a98dc3 100644 --- a/ecc-mod-arith.c +++ b/ecc-mod-arith.c @@ -73,10 +73,12