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

Commit

Permalink
Merge 0fac9ed into 0842cc9
Browse files Browse the repository at this point in the history
  • Loading branch information
samuele-andreoli committed Mar 9, 2020
2 parents 0842cc9 + 0fac9ed commit 20f4695
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 5 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
6 changes: 4 additions & 2 deletions test/CMakeLists.txt
Expand Up @@ -160,8 +160,10 @@ foreach(curve ${AMCL_CURVE})
endif(CS STREQUAL "128")
amcl_curve_test(${curve} test_pair_${TC} test_pair_ZZZ.c.in amcl_pairing_${TC} "SUCCESS")

if(CMAKE_SYSTEM_NAME MATCHES "Linux")
# Test arithmetics debug output functions - Linux specific code
# Test arithmetics debug output functions - Linux specific code
# Skip the tests when using DEBUG_NORM, since it changes the raw
# output
if(CMAKE_SYSTEM_NAME MATCHES "Linux" AND NOT DEBUG_NORM)
amcl_curve_test(${curve} test_output_functions_${TC} test_output_functions_ZZZ.c.in amcl_pairing_${TC} "SUCCESS" "output/test_vector_${TC}_${WORD_SIZE}.txt" "stdout.out")
endif(CMAKE_SYSTEM_NAME MATCHES "Linux")

Expand Down
2 changes: 1 addition & 1 deletion test/test_big_consistency_XXX.c.in
Expand Up @@ -112,7 +112,7 @@ int main()

/* Testing small multiplication and addition */
BIG_XXX_random(F,&rng);
for (j = 1; j <= 20; ++j)
for (j = 1; j <= NEXCESS_XXX; ++j)
{
BIG_XXX_imul(H,F,j);
BIG_XXX_copy(G,F);
Expand Down

0 comments on commit 20f4695

Please sign in to comment.