diff --git a/mp_prime_frobenius_underwood.c b/mp_prime_frobenius_underwood.c index ced0583..0e2ba64 100644 --- a/mp_prime_frobenius_underwood.c +++ b/mp_prime_frobenius_underwood.c @@ -39,12 +39,8 @@ mp_err mp_prime_frobenius_underwood(const mp_int *N, mp_bool *result) (a==14) || (a==18) || (a==23) || (a==26) || (a==28)) { continue; } - /* (32764^2 - 4) < 2^31, no bigint for >MP_8BIT needed) */ - mp_set_u32(&T1z, (uint32_t)a); - if ((err = mp_sqr(&T1z, &T1z)) != MP_OKAY) goto LBL_FU_ERR; - - if ((err = mp_sub_d(&T1z, 4uL, &T1z)) != MP_OKAY) goto LBL_FU_ERR; + mp_set_i32(&T1z, (int32_t)((a * a) - 4)); if ((err = mp_kronecker(&T1z, N, &j)) != MP_OKAY) goto LBL_FU_ERR; diff --git a/tommath_class.h b/tommath_class.h index c6dcde1..52c5e45 100644 --- a/tommath_class.h +++ b/tommath_class.h @@ -659,10 +659,9 @@ # define MP_MUL_C # define MP_MUL_D_C # define MP_SET_C +# define MP_SET_I32_C # define MP_SET_U32_C -# define MP_SQR_C # define MP_SUB_C -# define MP_SUB_D_C # define S_MP_GET_BIT_C #endif