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

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