Check GOST parameters are not NULL (CVE-2012-0027)
authorDr. Stephen Henson <steve@openssl.org>
Wed, 4 Jan 2012 23:03:40 +0000 (23:03 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Wed, 4 Jan 2012 23:03:40 +0000 (23:03 +0000)
CHANGES
engines/ccgost/gost2001_keyx.c
engines/ccgost/gost94_keyx.c

diff --git a/CHANGES b/CHANGES
index 7c31eadb7a1f93fe380b76bed5f828ffc0bd9b60..f310a750751b892b897b4f43c50bd1ce5404c7e7 100644 (file)
--- a/CHANGES
+++ b/CHANGES
   *) Add support for SCTP.
      [Robin Seggelmann <seggelmann@fh-muenster.de>]
 
+  *) Check parameters are not NULL in GOST ENGINE. (CVE-2012-0027)
+     [Andrey Kulikov <amdeich@gmail.com>]
+
   *) Prevent malformed RFC3779 data triggering an assertion failure.
      Thanks to Andrew Chi, BBN Technologies, for discovering the flaw
      and Rob Austein <sra@hactrn.net> for fixing it. (CVE-2011-4577)
index 00759bcab06b568d3b0121f4a87f2db2f0647b99..c748102857d7744fc058e055a23ac6b488f54cb1 100644 (file)
@@ -280,6 +280,10 @@ int pkey_GOST01cp_decrypt(EVP_PKEY_CTX *pctx, unsigned char *key, size_t * key_l
                }
                
        param = get_encryption_params(gkt->key_agreement_info->cipher);
+    if(!param){
+        goto err;
+    }
+
        gost_init(&ctx,param->sblock);  
        OPENSSL_assert(gkt->key_agreement_info->eph_iv->length==8);
        memcpy(wrappedKey,gkt->key_agreement_info->eph_iv->data,8);
index 624be586a5bbceaab80417e8ffd6c2571b983f5b..0d7d3ffe6aa7484a03a2965c99828b97e6b63f7b 100644 (file)
@@ -261,6 +261,10 @@ int pkey_GOST94cp_decrypt(EVP_PKEY_CTX *ctx, unsigned char *key, size_t *key_len
                }
 
        param = get_encryption_params(gkt->key_agreement_info->cipher);
+    if(!param){
+        goto err;
+    }
+       
        gost_init(&cctx,param->sblock); 
        OPENSSL_assert(gkt->key_agreement_info->eph_iv->length==8);
        memcpy(wrappedKey,gkt->key_agreement_info->eph_iv->data,8);