General improvements to the ec_asn1.c code. This squashes at least one bug