diff options
Diffstat (limited to 'crypto/ec/curve448/f_arithmetic.c')
-rw-r--r-- | crypto/ec/curve448/f_arithmetic.c | 62 |
1 files changed, 30 insertions, 32 deletions
diff --git a/crypto/ec/curve448/f_arithmetic.c b/crypto/ec/curve448/f_arithmetic.c index 1e824e2433..e8c5738d07 100644 --- a/crypto/ec/curve448/f_arithmetic.c +++ b/crypto/ec/curve448/f_arithmetic.c @@ -12,37 +12,35 @@ #include "field.h" -mask_t gf_isr ( - gf a, - const gf x -) { +mask_t gf_isr(gf a, const gf x) +{ gf L0, L1, L2; - gf_sqr (L1, x ); - gf_mul (L2, x, L1 ); - gf_sqr (L1, L2 ); - gf_mul (L2, x, L1 ); - gf_sqrn (L1, L2, 3 ); - gf_mul (L0, L2, L1 ); - gf_sqrn (L1, L0, 3 ); - gf_mul (L0, L2, L1 ); - gf_sqrn (L2, L0, 9 ); - gf_mul (L1, L0, L2 ); - gf_sqr (L0, L1 ); - gf_mul (L2, x, L0 ); - gf_sqrn (L0, L2, 18 ); - gf_mul (L2, L1, L0 ); - gf_sqrn (L0, L2, 37 ); - gf_mul (L1, L2, L0 ); - gf_sqrn (L0, L1, 37 ); - gf_mul (L1, L2, L0 ); - gf_sqrn (L0, L1, 111 ); - gf_mul (L2, L1, L0 ); - gf_sqr (L0, L2 ); - gf_mul (L1, x, L0 ); - gf_sqrn (L0, L1, 223 ); - gf_mul (L1, L2, L0 ); - gf_sqr (L2, L1); - gf_mul (L0, L2, x); - gf_copy(a,L1); - return gf_eq(L0,ONE); + gf_sqr(L1, x); + gf_mul(L2, x, L1); + gf_sqr(L1, L2); + gf_mul(L2, x, L1); + gf_sqrn(L1, L2, 3); + gf_mul(L0, L2, L1); + gf_sqrn(L1, L0, 3); + gf_mul(L0, L2, L1); + gf_sqrn(L2, L0, 9); + gf_mul(L1, L0, L2); + gf_sqr(L0, L1); + gf_mul(L2, x, L0); + gf_sqrn(L0, L2, 18); + gf_mul(L2, L1, L0); + gf_sqrn(L0, L2, 37); + gf_mul(L1, L2, L0); + gf_sqrn(L0, L1, 37); + gf_mul(L1, L2, L0); + gf_sqrn(L0, L1, 111); + gf_mul(L2, L1, L0); + gf_sqr(L0, L2); + gf_mul(L1, x, L0); + gf_sqrn(L0, L1, 223); + gf_mul(L1, L2, L0); + gf_sqr(L2, L1); + gf_mul(L0, L2, x); + gf_copy(a, L1); + return gf_eq(L0, ONE); } |