Remove unrolled loops
[openssl.git] / crypto / ec / curve448 / f_generic.c
index e779f223355eda9573735742992960e8fd434c2d..6babea6e41717776d822d71821993d61c077b0f0 100644 (file)
@@ -30,7 +30,7 @@ void gf_serialize(uint8_t serial[SER_BYTES], const gf x, int with_hibit)
     if (!with_hibit)
         assert(gf_hibit(red) == 0);
 
     if (!with_hibit)
         assert(gf_hibit(red) == 0);
 
-    UNROLL for (i = 0; i < (with_hibit ? X_SER_BYTES : SER_BYTES); i++) {
+    for (i = 0; i < (with_hibit ? X_SER_BYTES : SER_BYTES); i++) {
         if (fill < 8 && j < NLIMBS) {
             buffer |= ((dword_t) red->limb[LIMBPERM(j)]) << fill;
             fill += LIMB_PLACE_VALUE(LIMBPERM(j));
         if (fill < 8 && j < NLIMBS) {
             buffer |= ((dword_t) red->limb[LIMBPERM(j)]) << fill;
             fill += LIMB_PLACE_VALUE(LIMBPERM(j));
@@ -46,6 +46,7 @@ void gf_serialize(uint8_t serial[SER_BYTES], const gf x, int with_hibit)
 mask_t gf_hibit(const gf x)
 {
     gf y;
 mask_t gf_hibit(const gf x)
 {
     gf y;
+
     gf_add(y, x, x);
     gf_strong_reduce(y);
     return 0 - (y->limb[0] & 1);
     gf_add(y, x, x);
     gf_strong_reduce(y);
     return 0 - (y->limb[0] & 1);
@@ -55,6 +56,7 @@ mask_t gf_hibit(const gf x)
 mask_t gf_lobit(const gf x)
 {
     gf y;
 mask_t gf_lobit(const gf x)
 {
     gf y;
+
     gf_copy(y, x);
     gf_strong_reduce(y);
     return 0 - (y->limb[0] & 1);
     gf_copy(y, x);
     gf_strong_reduce(y);
     return 0 - (y->limb[0] & 1);
@@ -71,9 +73,11 @@ mask_t gf_deserialize(gf x, const uint8_t serial[SER_BYTES], int with_hibit,
     unsigned int i;
     mask_t succ;
 
     unsigned int i;
     mask_t succ;
 
-    UNROLL for (i = 0; i < NLIMBS; i++) {
-        UNROLL while (fill < LIMB_PLACE_VALUE(LIMBPERM(i)) && j < nbytes) {
-            uint8_t sj = serial[j];
+    for (i = 0; i < NLIMBS; i++) {
+        while (fill < LIMB_PLACE_VALUE(LIMBPERM(i)) && j < nbytes) {
+            uint8_t sj;
+
+            sj = serial[j];
             if (j == nbytes - 1)
                 sj &= ~hi_nmask;
             buffer |= ((dword_t) sj) << fill;
             if (j == nbytes - 1)
                 sj &= ~hi_nmask;
             buffer |= ((dword_t) sj) << fill;
@@ -159,9 +163,8 @@ mask_t gf_eq(const gf a, const gf b)
     gf_sub(c, a, b);
     gf_strong_reduce(c);
 
     gf_sub(c, a, b);
     gf_strong_reduce(c);
 
-    for (i = 0; i < NLIMBS; i++) {
+    for (i = 0; i < NLIMBS; i++)
         ret |= c->limb[LIMBPERM(i)];
         ret |= c->limb[LIMBPERM(i)];
-    }
 
     return word_is_zero(ret);
 }
 
     return word_is_zero(ret);
 }
@@ -169,6 +172,7 @@ mask_t gf_eq(const gf a, const gf b)
 mask_t gf_isr(gf a, const gf x)
 {
     gf L0, L1, L2;
 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_sqr(L1, x);
     gf_mul(L2, x, L1);
     gf_sqr(L1, L2);