[openssl-commits] [openssl] OpenSSL_1_1_0-stable update

Kurt Roeckx kurt at openssl.org
Mon Jan 9 21:33:52 UTC 2017


The branch OpenSSL_1_1_0-stable has been updated
       via  db2fed4443042db3e7921810d944cfd15d347d08 (commit)
      from  3dca6ca0df0facedabcc5d9733b304e507f796db (commit)


- Log -----------------------------------------------------------------
commit db2fed4443042db3e7921810d944cfd15d347d08
Author: Bernd Edlinger <bernd.edlinger at hotmail.de>
Date:   Fri Dec 23 14:35:16 2016 +0100

    Fix a memory leak in RSA_padding_add_PKCS1_OAEP_mgf1
    
    Signed-off-by: Kurt Roeckx <kurt at roeckx.be>
    Reviewed-by: Matt Caswell <matt at openssl.org>
    GH: #2140
    (cherry picked from commit c6d215e0d278fcd51ad474a3647b61e1b67290bb)

-----------------------------------------------------------------------

Summary of changes:
 crypto/rsa/rsa_oaep.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/crypto/rsa/rsa_oaep.c b/crypto/rsa/rsa_oaep.c
index c459b91..868104f 100644
--- a/crypto/rsa/rsa_oaep.c
+++ b/crypto/rsa/rsa_oaep.c
@@ -91,17 +91,21 @@ int RSA_padding_add_PKCS1_OAEP_mgf1(unsigned char *to, int tlen,
     }
 
     if (PKCS1_MGF1(dbmask, emlen - mdlen, seed, mdlen, mgf1md) < 0)
-        return 0;
+        goto err;
     for (i = 0; i < emlen - mdlen; i++)
         db[i] ^= dbmask[i];
 
     if (PKCS1_MGF1(seedmask, mdlen, db, emlen - mdlen, mgf1md) < 0)
-        return 0;
+        goto err;
     for (i = 0; i < mdlen; i++)
         seed[i] ^= seedmask[i];
 
     OPENSSL_free(dbmask);
     return 1;
+
+ err:
+    OPENSSL_free(dbmask);
+    return 0;
 }
 
 int RSA_padding_check_PKCS1_OAEP(unsigned char *to, int tlen,


More information about the openssl-commits mailing list