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

Rich Salz rsalz at openssl.org
Wed Jun 14 13:44:45 UTC 2017


The branch OpenSSL_1_1_0-stable has been updated
       via  48dd11a8c100988caf5c5a2fe5b66db6e86a83f4 (commit)
      from  8ab4fed9bdcc5b8498b3d59d2fa72dd045f63539 (commit)


- Log -----------------------------------------------------------------
commit 48dd11a8c100988caf5c5a2fe5b66db6e86a83f4
Author: Bernd Edlinger <bernd.edlinger at hotmail.de>
Date:   Tue Jun 13 22:34:30 2017 +0200

    Fix possible crash in X931 code.
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/3675)
    (cherry picked from commit 5419dadd4bd1f7abbfa23326ca766d2c143f257c)

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

Summary of changes:
 crypto/bn/bn_x931p.c   | 8 ++++++--
 crypto/rsa/rsa_x931g.c | 2 ++
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/crypto/bn/bn_x931p.c b/crypto/bn/bn_x931p.c
index 40734cb..8bfbcac 100644
--- a/crypto/bn/bn_x931p.c
+++ b/crypto/bn/bn_x931p.c
@@ -178,6 +178,8 @@ int BN_X931_generate_Xpq(BIGNUM *Xp, BIGNUM *Xq, int nbits, BN_CTX *ctx)
 
     BN_CTX_start(ctx);
     t = BN_CTX_get(ctx);
+    if (t == NULL)
+        goto err;
 
     for (i = 0; i < 1000; i++) {
         if (!BN_rand(Xq, nbits, BN_RAND_TOP_TWO, BN_RAND_BOTTOM_ANY))
@@ -216,10 +218,12 @@ int BN_X931_generate_prime_ex(BIGNUM *p, BIGNUM *p1, BIGNUM *p2,
     int ret = 0;
 
     BN_CTX_start(ctx);
-    if (!Xp1)
+    if (Xp1 == NULL)
         Xp1 = BN_CTX_get(ctx);
-    if (!Xp2)
+    if (Xp2 == NULL)
         Xp2 = BN_CTX_get(ctx);
+    if (Xp1 == NULL || Xp2 == NULL)
+        goto error;
 
     if (!BN_rand(Xp1, 101, BN_RAND_TOP_ONE, BN_RAND_BOTTOM_ANY))
         goto error;
diff --git a/crypto/rsa/rsa_x931g.c b/crypto/rsa/rsa_x931g.c
index 9dd993f..877ee22 100644
--- a/crypto/rsa/rsa_x931g.c
+++ b/crypto/rsa/rsa_x931g.c
@@ -153,6 +153,8 @@ int RSA_X931_generate_key_ex(RSA *rsa, int bits, const BIGNUM *e,
     BN_CTX_start(ctx);
     Xp = BN_CTX_get(ctx);
     Xq = BN_CTX_get(ctx);
+    if (Xq == NULL)
+        goto error;
     if (!BN_X931_generate_Xpq(Xp, Xq, bits, ctx))
         goto error;
 


More information about the openssl-commits mailing list