PR: 1990
[oweals/openssl.git] / crypto / ec / ec2_mult.c
index a0effa95ad8ba93b95ba3d94afb8a95536bb8576..ff368fd7d7b3d277db18ab1884aa59201d80692a 100644 (file)
@@ -155,8 +155,8 @@ static int gf2m_Mxy(const EC_GROUP *group, const BIGNUM *x, const BIGNUM *y, BIG
        
        if (BN_is_zero(z1))
                {
-               if (!BN_zero(x2)) return 0;
-               if (!BN_zero(z2)) return 0;
+               BN_zero(x2);
+               BN_zero(z2);
                return 1;
                }
        
@@ -221,7 +221,7 @@ static int ec_GF2m_montgomery_point_multiply(const EC_GROUP *group, EC_POINT *r,
 
        if (r == point)
                {
-               ECerr(EC_F_EC_POINT_MUL, EC_R_INVALID_ARGUMENT);
+               ECerr(EC_F_EC_GF2M_MONTGOMERY_POINT_MULTIPLY, EC_R_INVALID_ARGUMENT);
                return 0;
                }
        
@@ -296,8 +296,8 @@ static int ec_GF2m_montgomery_point_multiply(const EC_GROUP *group, EC_POINT *r,
                }
 
        /* GF(2^m) field elements should always have BIGNUM::neg = 0 */
-       BN_set_sign(&r->X, 0);
-       BN_set_sign(&r->Y, 0);
+       BN_set_negative(&r->X, 0);
+       BN_set_negative(&r->Y, 0);
 
        ret = 1;
 
@@ -315,7 +315,8 @@ int ec_GF2m_simple_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar,
        size_t num, const EC_POINT *points[], const BIGNUM *scalars[], BN_CTX *ctx)
        {
        BN_CTX *new_ctx = NULL;
-       int ret = 0, i;
+       int ret = 0;
+       size_t i;
        EC_POINT *p=NULL;
 
        if (ctx == NULL)
@@ -342,7 +343,7 @@ int ec_GF2m_simple_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar,
        if (scalar)
                {
                if (!ec_GF2m_montgomery_point_multiply(group, p, scalar, group->generator, ctx)) goto err;
-               if (BN_get_sign(scalar)) 
+               if (BN_is_negative(scalar)) 
                        if (!group->meth->invert(group, p, ctx)) goto err;
                if (!group->meth->add(group, r, r, p, ctx)) goto err;
                }
@@ -350,7 +351,7 @@ int ec_GF2m_simple_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar,
        for (i = 0; i < num; i++)
                {
                if (!ec_GF2m_montgomery_point_multiply(group, p, scalars[i], points[i], ctx)) goto err;
-               if (BN_get_sign(scalars[i]))
+               if (BN_is_negative(scalars[i]))
                        if (!group->meth->invert(group, p, ctx)) goto err;
                if (!group->meth->add(group, r, r, p, ctx)) goto err;
                }