Skip to content
This repository has been archived by the owner on Mar 25, 2024. It is now read-only.

Commit

Permalink
Add missing norms
Browse files Browse the repository at this point in the history
  • Loading branch information
samuele-andreoli committed Mar 5, 2020
1 parent 32a517b commit 0fac9ed
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/ecp2.c.in
Expand Up @@ -641,6 +641,7 @@ void ECP2_ZZZ_mapit(ECP2_ZZZ *Q,octet *W)
FP2_YYY_from_BIGs(&X,one,hv);
if (ECP2_ZZZ_setx(Q,&X)) break;
BIG_XXX_inc(hv,1);
BIG_XXX_norm(hv);
}

BIG_XXX_rcopy(Fx,Fra_YYY);
Expand Down
1 change: 1 addition & 0 deletions src/ecp4.c.in
Expand Up @@ -744,6 +744,7 @@ void ECP4_ZZZ_mapit(ECP4_ZZZ *Q,octet *W)
FP4_YYY_from_FP2(&X4,&T);
if (ECP4_ZZZ_setx(Q,&X4)) break;
BIG_XXX_inc(hv,1);
BIG_XXX_norm(hv);
}

ECP4_ZZZ_frob_constants(X);
Expand Down
1 change: 1 addition & 0 deletions src/ecp8.c.in
Expand Up @@ -893,6 +893,7 @@ void ECP8_ZZZ_mapit(ECP8_ZZZ *Q,octet *W)
FP8_YYY_from_FP4(&X8,&X4);
if (ECP8_ZZZ_setx(Q,&X8)) break;
BIG_XXX_inc(hv,1);
BIG_XXX_norm(hv);
}

ECP8_ZZZ_frob_constants(X);
Expand Down
1 change: 1 addition & 0 deletions src/fp.c.in
Expand Up @@ -767,6 +767,7 @@ void FP_YYY_sqrt(FP_YYY *r,FP_YYY *a)
FP_YYY_mul(&i,&i,&v); // i=(2x)^(p+3)/8
FP_YYY_mul(&i,&i,&v); // i=(2x)^(p-1)/4
BIG_XXX_dec(i.g,1); // i=(2x)^(p-1)/4 - 1
BIG_XXX_norm(i.g);
FP_YYY_mul(r,a,&v);
FP_YYY_mul(r,r,&i);
FP_YYY_reduce(r);
Expand Down
1 change: 1 addition & 0 deletions src/fp4.c.in
Expand Up @@ -624,6 +624,7 @@ int FP4_YYY_sqrt(FP4_YYY *r,FP4_YYY* x)
FP2_YYY_mul_ip(&s);
FP2_YYY_norm(&s);
FP2_YYY_sub(&a,&a,&s); // a-=txx(s)
FP2_YYY_norm(&a);

if (!FP2_YYY_sqrt(&s,&a)) return 0;

Expand Down
4 changes: 2 additions & 2 deletions src/fp8.c.in
Expand Up @@ -614,12 +614,12 @@ int FP8_YYY_sqrt(FP8_YYY *r,FP8_YYY* x)
FP4_YYY_times_i(&s);
FP4_YYY_norm(&s);
FP4_YYY_sub(&a,&a,&s); // a-=txx(s)
FP4_YYY_norm(&a);

if (!FP4_YYY_sqrt(&s,&a)) return 0;

FP4_YYY_sqr(&t,&s);


FP4_YYY_copy(&t,&(x->a));
FP4_YYY_add(&a,&t,&s);
FP4_YYY_norm(&a);
Expand All @@ -635,13 +635,13 @@ int FP8_YYY_sqrt(FP8_YYY *r,FP8_YYY* x)

FP4_YYY_copy(&t,&(x->b));
FP4_YYY_add(&s,&a,&a);
FP4_YYY_norm(&s);
FP4_YYY_inv(&s,&s);

FP4_YYY_mul(&t,&t,&s);
FP8_YYY_from_FP4s(r,&a,&t);

return 1;

}


Expand Down

0 comments on commit 0fac9ed

Please sign in to comment.