Blame SOURCES/openssl-1.0.1e-cve-2016-2108.patch

5fee79
diff -up openssl-1.0.1e/crypto/asn1/a_int.c.asn1-negative openssl-1.0.1e/crypto/asn1/a_int.c
5fee79
--- openssl-1.0.1e/crypto/asn1/a_int.c.asn1-negative	2016-04-29 13:23:05.221797998 +0200
5fee79
+++ openssl-1.0.1e/crypto/asn1/a_int.c	2016-04-29 13:26:51.030957218 +0200
5fee79
@@ -124,6 +124,8 @@ int i2c_ASN1_INTEGER(ASN1_INTEGER *a, un
5fee79
 		{
5fee79
 		ret=a->length;
5fee79
 		i=a->data[0];
5fee79
+		if (ret == 1 && i == 0)
5fee79
+			neg = 0;
5fee79
 		if (!neg && (i > 127)) {
5fee79
 			pad=1;
5fee79
 			pb=0;
5fee79
@@ -157,7 +159,7 @@ int i2c_ASN1_INTEGER(ASN1_INTEGER *a, un
5fee79
 		p += a->length - 1;
5fee79
 		i = a->length;
5fee79
 		/* Copy zeros to destination as long as source is zero */
5fee79
-		while(!*n) {
5fee79
+		while(!*n && i > 1) {
5fee79
 			*(p--) = 0;
5fee79
 			n--;
5fee79
 			i--;
5fee79
@@ -415,7 +417,7 @@ ASN1_INTEGER *BN_to_ASN1_INTEGER(const B
5fee79
 		ASN1err(ASN1_F_BN_TO_ASN1_INTEGER,ERR_R_NESTED_ASN1_ERROR);
5fee79
 		goto err;
5fee79
 		}
5fee79
-	if (BN_is_negative(bn))
5fee79
+	if (BN_is_negative(bn) && !BN_is_zero(bn))
5fee79
 		ret->type = V_ASN1_NEG_INTEGER;
5fee79
 	else ret->type=V_ASN1_INTEGER;
5fee79
 	j=BN_num_bits(bn);
5fee79
diff -up openssl-1.0.1e/crypto/asn1/a_type.c.asn1-negative openssl-1.0.1e/crypto/asn1/a_type.c
5fee79
--- openssl-1.0.1e/crypto/asn1/a_type.c.asn1-negative	2016-04-29 12:42:43.000000000 +0200
5fee79
+++ openssl-1.0.1e/crypto/asn1/a_type.c	2016-04-29 13:28:40.202443787 +0200
5fee79
@@ -131,9 +131,7 @@ int ASN1_TYPE_cmp(const ASN1_TYPE *a, co
5fee79
 		result = 0;	/* They do not have content. */
5fee79
 		break;
5fee79
 	case V_ASN1_INTEGER:
5fee79
-	case V_ASN1_NEG_INTEGER:
5fee79
 	case V_ASN1_ENUMERATED:
5fee79
-	case V_ASN1_NEG_ENUMERATED:
5fee79
 	case V_ASN1_BIT_STRING:
5fee79
 	case V_ASN1_OCTET_STRING:
5fee79
 	case V_ASN1_SEQUENCE:
5fee79
diff -up openssl-1.0.1e/crypto/asn1/tasn_dec.c.asn1-negative openssl-1.0.1e/crypto/asn1/tasn_dec.c
5fee79
--- openssl-1.0.1e/crypto/asn1/tasn_dec.c.asn1-negative	2016-04-29 12:42:43.000000000 +0200
5fee79
+++ openssl-1.0.1e/crypto/asn1/tasn_dec.c	2016-04-29 13:30:08.560456293 +0200
5fee79
@@ -1011,9 +1011,7 @@ int asn1_ex_c2i(ASN1_VALUE **pval, const
5fee79
 		break;
5fee79
 
5fee79
 		case V_ASN1_INTEGER:
5fee79
-		case V_ASN1_NEG_INTEGER:
5fee79
 		case V_ASN1_ENUMERATED:
5fee79
-		case V_ASN1_NEG_ENUMERATED:
5fee79
 		tint = (ASN1_INTEGER **)pval;
5fee79
 		if (!c2i_ASN1_INTEGER(tint, &cont, len))
5fee79
 			goto err;
5fee79
diff -up openssl-1.0.1e/crypto/asn1/tasn_enc.c.asn1-negative openssl-1.0.1e/crypto/asn1/tasn_enc.c
5fee79
--- openssl-1.0.1e/crypto/asn1/tasn_enc.c.asn1-negative	2013-02-11 16:26:04.000000000 +0100
5fee79
+++ openssl-1.0.1e/crypto/asn1/tasn_enc.c	2016-04-29 13:30:34.688051394 +0200
5fee79
@@ -638,9 +638,7 @@ int asn1_ex_i2c(ASN1_VALUE **pval, unsig
5fee79
 		break;
5fee79
 
5fee79
 		case V_ASN1_INTEGER:
5fee79
-		case V_ASN1_NEG_INTEGER:
5fee79
 		case V_ASN1_ENUMERATED:
5fee79
-		case V_ASN1_NEG_ENUMERATED:
5fee79
 		/* These are all have the same content format
5fee79
 		 * as ASN1_INTEGER
5fee79
 		 */