Blame SOURCES/openssl-fips-0.9.8e-cve-2009-3245.patch

c4366c
diff -up openssl-fips-0.9.8e/crypto/bn/bn_gf2m.c.wexpand openssl-fips-0.9.8e/crypto/bn/bn_gf2m.c
c4366c
--- openssl-fips-0.9.8e/crypto/bn/bn_gf2m.c.wexpand	2006-02-08 20:16:11.000000000 +0100
c4366c
+++ openssl-fips-0.9.8e/crypto/bn/bn_gf2m.c	2010-03-12 13:28:55.000000000 +0100
c4366c
@@ -294,7 +294,8 @@ int	BN_GF2m_add(BIGNUM *r, const BIGNUM 
c4366c
 	if (a->top < b->top) { at = b; bt = a; }
c4366c
 	else { at = a; bt = b; }
c4366c
 
c4366c
-	bn_wexpand(r, at->top);
c4366c
+	if(bn_wexpand(r, at->top) == NULL)
c4366c
+		return 0;
c4366c
 
c4366c
 	for (i = 0; i < bt->top; i++)
c4366c
 		{
c4366c
diff -up openssl-fips-0.9.8e/crypto/bn/bn_mul.c.wexpand openssl-fips-0.9.8e/crypto/bn/bn_mul.c
c4366c
--- openssl-fips-0.9.8e/crypto/bn/bn_mul.c.wexpand	2010-02-18 15:58:31.000000000 +0100
c4366c
+++ openssl-fips-0.9.8e/crypto/bn/bn_mul.c	2010-03-12 13:27:24.000000000 +0100
c4366c
@@ -1030,15 +1030,15 @@ int BN_mul(BIGNUM *r, const BIGNUM *a, c
c4366c
 			t = BN_CTX_get(ctx);
c4366c
 			if (al > j || bl > j)
c4366c
 				{
c4366c
-				bn_wexpand(t,k*4);
c4366c
-				bn_wexpand(rr,k*4);
c4366c
+				if (bn_wexpand(t,k*4) == NULL) goto err;
c4366c
+				if (bn_wexpand(rr,k*4) == NULL) goto err;
c4366c
 				bn_mul_part_recursive(rr->d,a->d,b->d,
c4366c
 					j,al-j,bl-j,t->d);
c4366c
 				}
c4366c
 			else	/* al <= j || bl <= j */
c4366c
 				{
c4366c
-				bn_wexpand(t,k*2);
c4366c
-				bn_wexpand(rr,k*2);
c4366c
+				if (bn_wexpand(t,k*2) == NULL) goto err;
c4366c
+				if (bn_wexpand(rr,k*2) == NULL) goto err;
c4366c
 				bn_mul_recursive(rr->d,a->d,b->d,
c4366c
 					j,al-j,bl-j,t->d);
c4366c
 				}
c4366c
diff -up openssl-fips-0.9.8e/engines/e_ubsec.c.wexpand openssl-fips-0.9.8e/engines/e_ubsec.c
c4366c
--- openssl-fips-0.9.8e/engines/e_ubsec.c.wexpand	2005-07-16 13:13:08.000000000 +0200
c4366c
+++ openssl-fips-0.9.8e/engines/e_ubsec.c	2010-03-12 13:30:07.000000000 +0100
c4366c
@@ -934,7 +934,7 @@ static int ubsec_dh_generate_key(DH *dh)
c4366c
                 priv_key = BN_new();
c4366c
                 if (priv_key == NULL) goto err;
c4366c
                 priv_key_len = BN_num_bits(dh->p);
c4366c
-                bn_wexpand(priv_key, dh->p->top);
c4366c
+                if (bn_wexpand(priv_key, dh->p->top) == NULL) goto err;
c4366c
                 do
c4366c
                         if (!BN_rand_range(priv_key, dh->p)) goto err;
c4366c
                 while (BN_is_zero(priv_key));
c4366c
@@ -949,7 +949,7 @@ static int ubsec_dh_generate_key(DH *dh)
c4366c
                 {
c4366c
                 pub_key = BN_new();
c4366c
                 pub_key_len = BN_num_bits(dh->p);
c4366c
-                bn_wexpand(pub_key, dh->p->top);
c4366c
+                if(bn_wexpand(pub_key, dh->p->top) == NULL) goto err;
c4366c
                 if(pub_key == NULL) goto err;
c4366c
                 }
c4366c
         else