Hi,

This is a patch that uses BN_CTX_start/end to correctly initialize the
BN_CTX stack in EC_KEY_set_public_key_affine_coordinates.

-Steven

-- 
Ticket here: http://rt.openssl.org/Ticket/Display.html?id=4363
Please log in as guest with password guest if prompted

>From 842278f5f12601d7424cdb516706ef1218b72975 Mon Sep 17 00:00:00 2001
From: Steven Valdez <sval...@google.com>
Date: Tue, 1 Mar 2016 13:20:43 -0500
Subject: [PATCH] Adding missing BN_CTX_(start/end) in crypto/ec/ec_key.c

---
 crypto/ec/ec_key.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/crypto/ec/ec_key.c b/crypto/ec/ec_key.c
index 7d8507c..0d6c625 100644
--- a/crypto/ec/ec_key.c
+++ b/crypto/ec/ec_key.c
@@ -360,8 +360,9 @@ int EC_KEY_set_public_key_affine_coordinates(EC_KEY *key, BIGNUM *x,
     }
     ctx = BN_CTX_new();
     if (ctx == NULL)
-        goto err;
+        return 0;
 
+    BN_CTX_start(ctx);
     point = EC_POINT_new(key->group);
 
     if (point == NULL)
@@ -416,6 +417,7 @@ int EC_KEY_set_public_key_affine_coordinates(EC_KEY *key, BIGNUM *x,
     ok = 1;
 
  err:
+    BN_CTX_end(ctx);
     BN_CTX_free(ctx);
     EC_POINT_free(point);
     return ok;
-- 
2.7.0.rc3.207.g0ac5344
-- 
openssl-dev mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-dev

Reply via email to