Skip to content

Commit

Permalink
More adapting to C99
Browse files Browse the repository at this point in the history
  • Loading branch information
czurnieden committed Mar 7, 2023
1 parent 119e431 commit c5cf790
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions mp_prime_extra_strong_lucas.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ mp_err mp_prime_extra_strong_lucas(const mp_int *N, bool *result)
mp_int Dz, s, Vk, Vk1, tmp1, Nm2;
uint32_t D, P;
int32_t j, r, nbits;
int i;
mp_err err = MP_OKAY;

*result = false;
Expand Down Expand Up @@ -83,7 +84,7 @@ mp_err mp_prime_extra_strong_lucas(const mp_int *N, bool *result)
mp_set_u32(&Vk1, P);
nbits = mp_count_bits(&s);
/* Compute Lucas sequence of V */
for (int i = nbits; i >= 0; i--) {
for (i = nbits; i >= 0; i--) {
if ((err = mp_mul(&Vk, &Vk1, &tmp1)) != MP_OKAY) goto LTM_ERR;
if ((err = mp_add(&tmp1, N, &tmp1)) != MP_OKAY) goto LTM_ERR;
if ((err = mp_sub_d(&tmp1, P, &tmp1)) != MP_OKAY) goto LTM_ERR;
Expand Down Expand Up @@ -114,7 +115,7 @@ mp_err mp_prime_extra_strong_lucas(const mp_int *N, bool *result)
}
}
/* Check for V_{2^t k} = 0 mod N for some t 0 <= t < r - 1 ([3])*/
for (int i = 0; i < (r - 1); i++) {
for (i = 0; i < (r - 1); i++) {
if (mp_iszero(&Vk)) {
*result = true;
goto LTM_ERR;
Expand Down

0 comments on commit c5cf790

Please sign in to comment.