Fix eckey_priv_encode()
authormancha <mancha1@zoho.com>
Thu, 24 Apr 2014 19:06:20 +0000 (19:06 +0000)
committermancha <mancha1@zoho.com>
Thu, 24 Apr 2014 19:33:01 +0000 (19:33 +0000)
Fix eckey_priv_encode to return an error on failure of i2d_ECPrivateKey.

CHANGES
crypto/ec/ec_ameth.c

diff --git a/CHANGES b/CHANGES
index b2d3d98e439989f643b9376748cf0dd49de310fa..9b9b72142e39a5f09e91f039bcce67fe9abf555a 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -4,6 +4,10 @@
 
  Changes between 1.0.0l and 1.0.0m [xx XXX xxxx]
 
+  *) Fix eckey_priv_encode so it immediately returns an error upon a failure
+     in i2d_ECPrivateKey.
+     [mancha <mancha1@zoho.com>]
+
   *) Fix some double frees. These are not thought to be exploitable.
      [mancha <mancha1@zoho.com>]
 
index c00f7d746c36e293a451a5aed64b144aef54c315..66c0d6c4d1706544515854be43307aa3cdb6083d 100644 (file)
@@ -352,6 +352,7 @@ static int eckey_priv_encode(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pkey)
                EC_KEY_set_enc_flags(ec_key, old_flags);
                OPENSSL_free(ep);
                ECerr(EC_F_ECKEY_PRIV_ENCODE, ERR_R_EC_LIB);
+               return 0;
        }
        /* restore old encoding flags */
        EC_KEY_set_enc_flags(ec_key, old_flags);