Commit 8a1656c01c594a5091de70b6f356811c34122c90

Francois Perrad 2018-07-09T20:46:22

refactor with for

diff --git a/bn_mp_sqrtmod_prime.c b/bn_mp_sqrtmod_prime.c
index f803760..a833ed7 100644
--- a/bn_mp_sqrtmod_prime.c
+++ b/bn_mp_sqrtmod_prime.c
@@ -61,7 +61,7 @@ mp_err mp_sqrtmod_prime(const mp_int *n, const mp_int *prime, mp_int *ret)
    /* find a Z such that the Legendre symbol (Z|prime) == -1 */
    mp_set_u32(&Z, 2u);
    /* Z = 2 */
-   while (1) {
+   for (;;) {
       if ((err = mp_kronecker(&Z, prime, &legendre)) != MP_OKAY)     goto cleanup;
       if (legendre == -1) break;
       if ((err = mp_add_d(&Z, 1uL, &Z)) != MP_OKAY)               goto cleanup;
@@ -81,10 +81,10 @@ mp_err mp_sqrtmod_prime(const mp_int *n, const mp_int *prime, mp_int *ret)
    /* M = S */
    mp_set_u32(&two, 2u);
 
-   while (1) {
+   for (;;) {
       if ((err = mp_copy(&T, &t1)) != MP_OKAY)                    goto cleanup;
       i = 0;
-      while (1) {
+      for (;;) {
          if (mp_cmp_d(&t1, 1uL) == MP_EQ) break;
          if ((err = mp_exptmod(&t1, &two, prime, &t1)) != MP_OKAY) goto cleanup;
          i++;