Update from 1.0.0-stable
[oweals/openssl.git] / crypto / bn / bn_gf2m.c
index e962e4f799c5c5081027405b5574bf4b7d10a4e8..f7551dacd91d08372b2f85f5bea5d4e4dbba37c9 100644 (file)
@@ -322,7 +322,11 @@ int BN_GF2m_mod_arr(BIGNUM *r, const BIGNUM *a, const int p[])
                if (zz == 0) break;
                d1 = BN_BITS2 - d0;
                
-               if (d0) z[dN] = (z[dN] << d1) >> d1; /* clear up the top d1 bits */
+               /* clear up the top d1 bits */
+               if (d0)
+                       z[dN] = (z[dN] << d1) >> d1;
+               else
+                       z[dN] = 0;
                z[0] ^= zz; /* reduction t^0 component */
 
                for (k = 1; p[k] != 0; k++)
@@ -855,8 +859,7 @@ err:
  */
 int BN_GF2m_mod_solve_quad_arr(BIGNUM *r, const BIGNUM *a_, const int p[], BN_CTX *ctx)
        {
-       int ret = 0, count = 0;
-       unsigned int j;
+       int ret = 0, count = 0, j;
        BIGNUM *a, *z, *rho, *w, *w2, *tmp;
 
        bn_check_top(a_);