--- openssl-1.0.1c.orig/crypto/asn1/tasn_prn.c	2012-03-29 13:48:43.000000000 -0400
+++ openssl-1.0.1c/crypto/asn1/tasn_prn.c	2012-09-27 11:32:05.931507916 -0400
@@ -475,12 +475,36 @@
 static int asn1_print_integer_ctx(BIO *out, ASN1_INTEGER *str,
 						const ASN1_PCTX *pctx)
 	{
-	char *s;
 	int ret = 1;
-	s = i2s_ASN1_INTEGER(NULL, str);
-	if (BIO_puts(out, s) <= 0)
-		ret = 0;
-	OPENSSL_free(s);
+	int i;
+	long l;
+	const char *neg;
+
+	if (str->length <= (int)sizeof(long))
+		{
+		l=ASN1_INTEGER_get(str);
+		if (str->type == V_ASN1_NEG_INTEGER)
+			{
+			l= -l;
+			neg="-";
+			}
+		else
+			neg="";
+		if (BIO_printf(out," %s%lu (%s0x%lx)",neg,l,neg,l) <= 0)
+			ret = 0;
+		}
+	else
+		{
+		neg=(str->type == V_ASN1_NEG_INTEGER)?" (Negative)":"";
+		if (BIO_printf(out,"%12s%s","",neg) <= 0) ret = 0;
+		for (i=0; i<str->length; i++)
+			{
+			if (BIO_printf(out,"%02x%c",str->data[i],
+				((i+1 == str->length)?' ':':')) <= 0)
+				ret = 0;
+			}
+		}
+
 	return ret;
 	}
 
