Remove unused internal macros
[openssl.git] / crypto / ec / ec2_smpl.c
index 358b81609dc414e52c90a03a4f3af815a2955cfb..66bff0dadc30adfb257ea6753472bb388605ac66 100644 (file)
@@ -134,13 +134,10 @@ int ec_GF2m_simple_group_init(EC_GROUP *group)
     group->a = BN_new();
     group->b = BN_new();
 
-    if (!group->field || !group->a || !group->b) {
-        if (group->field)
-            BN_free(group->field);
-        if (group->a)
-            BN_free(group->a);
-        if (group->b)
-            BN_free(group->b);
+    if (group->field == NULL || group->a == NULL || group->b == NULL) {
+        BN_free(group->field);
+        BN_free(group->a);
+        BN_free(group->b);
         return 0;
     }
     return 1;
@@ -318,8 +315,7 @@ int ec_GF2m_simple_group_check_discriminant(const EC_GROUP *group,
  err:
     if (ctx != NULL)
         BN_CTX_end(ctx);
-    if (new_ctx != NULL)
-        BN_CTX_free(new_ctx);
+    BN_CTX_free(new_ctx);
     return ret;
 }
 
@@ -330,13 +326,10 @@ int ec_GF2m_simple_point_init(EC_POINT *point)
     point->Y = BN_new();
     point->Z = BN_new();
 
-    if (!point->X || !point->Y || !point->Z) {
-        if (point->X)
-            BN_free(point->X);
-        if (point->Y)
-            BN_free(point->Y);
-        if (point->Z)
-            BN_free(point->Z);
+    if (point->X == NULL || point->Y == NULL || point->Z == NULL) {
+        BN_free(point->X);
+        BN_free(point->Y);
+        BN_free(point->Z);
         return 0;
     }
     return 1;
@@ -569,8 +562,7 @@ int ec_GF2m_simple_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a,
 
  err:
     BN_CTX_end(ctx);
-    if (new_ctx != NULL)
-        BN_CTX_free(new_ctx);
+    BN_CTX_free(new_ctx);
     return ret;
 }
 
@@ -639,12 +631,12 @@ int ec_GF2m_simple_is_on_curve(const EC_GROUP *group, const EC_POINT *point,
     if (lh == NULL)
         goto err;
 
-        /*-
-         * We have a curve defined by a Weierstrass equation
-         *      y^2 + x*y = x^3 + a*x^2 + b.
-         *  <=> x^3 + a*x^2 + x*y + b + y^2 = 0
-         *  <=> ((x + a) * x + y ) * x + b + y^2 = 0
-         */
+    /*-
+     * We have a curve defined by a Weierstrass equation
+     *      y^2 + x*y = x^3 + a*x^2 + b.
+     *  <=> x^3 + a*x^2 + x*y + b + y^2 = 0
+     *  <=> ((x + a) * x + y ) * x + b + y^2 = 0
+     */
     if (!BN_GF2m_add(lh, point->X, group->a))
         goto err;
     if (!field_mul(group, lh, lh, point->X, ctx))
@@ -663,8 +655,7 @@ int ec_GF2m_simple_is_on_curve(const EC_GROUP *group, const EC_POINT *point,
  err:
     if (ctx)
         BN_CTX_end(ctx);
-    if (new_ctx)
-        BN_CTX_free(new_ctx);
+    BN_CTX_free(new_ctx);
     return ret;
 }
 
@@ -716,8 +707,7 @@ int ec_GF2m_simple_cmp(const EC_GROUP *group, const EC_POINT *a,
  err:
     if (ctx)
         BN_CTX_end(ctx);
-    if (new_ctx)
-        BN_CTX_free(new_ctx);
+    BN_CTX_free(new_ctx);
     return ret;
 }
 
@@ -758,8 +748,7 @@ int ec_GF2m_simple_make_affine(const EC_GROUP *group, EC_POINT *point,
  err:
     if (ctx)
         BN_CTX_end(ctx);
-    if (new_ctx)
-        BN_CTX_free(new_ctx);
+    BN_CTX_free(new_ctx);
     return ret;
 }