Adding missing BN_CTX_(start/end) in crypto/ec/ec_key.c
authorSteven Valdez <svaldez@google.com>
Tue, 1 Mar 2016 18:20:43 +0000 (13:20 -0500)
committerDr. Stephen Henson <steve@openssl.org>
Wed, 11 May 2016 17:51:13 +0000 (18:51 +0100)
RT#4363

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Stephen Henson <steve@openssl.org>
(cherry picked from commit 2ab851b779a77d119e1677b2495b368a46d83eef)

Conflicts:
crypto/ec/ec_key.c

crypto/ec/ec_key.c

index bc94ab5661ffedb8ab176451e80c4d08e0329a44..456080ecfede4b2b3f17a9b73c9e4f27f287b0a1 100644 (file)
@@ -377,9 +377,9 @@ int EC_KEY_set_public_key_affine_coordinates(EC_KEY *key, BIGNUM *x,
         return 0;
     }
     ctx = BN_CTX_new();
-    if (!ctx)
-        goto err;
-
+    if (ctx == NULL)
+        return 0;
+    BN_CTX_start(ctx);
     point = EC_POINT_new(key->group);
 
     if (!point)
@@ -432,10 +432,9 @@ int EC_KEY_set_public_key_affine_coordinates(EC_KEY *key, BIGNUM *x,
     ok = 1;
 
  err:
-    if (ctx)
-        BN_CTX_free(ctx);
-    if (point)
-        EC_POINT_free(point);
+    BN_CTX_end(ctx);
+    BN_CTX_free(ctx);
+    EC_POINT_free(point);
     return ok;
 
 }