diff -ur -x CVS -x '*~' openssl-1.0.1e/crypto/ec/ec_ameth.c openssl-1.0.1e-ec2patch/crypto/ec/ec_ameth.c
--- openssl-1.0.1e/crypto/ec/ec_ameth.c	2013-02-11 15:26:04.000000000 +0000
+++ openssl-1.0.1e-ec2patch/crypto/ec/ec_ameth.c	2013-03-21 21:29:27.005310774 +0000
@@ -88,7 +88,7 @@
 		if (!pstr)
 			return 0;
 		pstr->length = i2d_ECParameters(ec_key, &pstr->data);
-		if (pstr->length < 0)
+		if (pstr->length <= 0)
 			{
 			ASN1_STRING_free(pstr);
 			ECerr(EC_F_ECKEY_PARAM2TYPE, ERR_R_EC_LIB);
diff -ur -x CVS -x '*~' openssl-1.0.1e/crypto/ec/ec_asn1.c openssl-1.0.1e-ec2patch/crypto/ec/ec_asn1.c
--- openssl-1.0.1e/crypto/ec/ec_asn1.c	2013-02-11 15:26:04.000000000 +0000
+++ openssl-1.0.1e-ec2patch/crypto/ec/ec_asn1.c	2013-03-21 21:51:08.577357375 +0000
@@ -89,7 +89,8 @@
 	if (group == NULL)
 		return 0;
 
-	if (EC_GROUP_method_of(group)->group_set_curve != ec_GF2m_simple_group_set_curve
+	if (EC_METHOD_get_field_type(EC_GROUP_method_of(group)) !=
+	    NID_X9_62_characteristic_two_field
 	    || !((group->poly[0] != 0) && (group->poly[1] != 0) && (group->poly[2] == 0)))
 		{
 		ECerr(EC_F_EC_GROUP_GET_TRINOMIAL_BASIS, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
@@ -107,7 +108,8 @@
 	if (group == NULL)
 		return 0;
 
-	if (EC_GROUP_method_of(group)->group_set_curve != ec_GF2m_simple_group_set_curve
+	if (EC_METHOD_get_field_type(EC_GROUP_method_of(group)) !=
+	    NID_X9_62_characteristic_two_field
 	    || !((group->poly[0] != 0) && (group->poly[1] != 0) && (group->poly[2] != 0) && (group->poly[3] != 0) && (group->poly[4] == 0)))
 		{
 		ECerr(EC_F_EC_GROUP_GET_PENTANOMIAL_BASIS, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
