ECP: Add a sanity check to mbedtls_ecp_ansi_write_group

Check for p != q at the end to ensure that everything went as it should.
diff --git a/library/ecp.c b/library/ecp.c
index 477ed0d..89b0af4 100644
--- a/library/ecp.c
+++ b/library/ecp.c
@@ -2082,6 +2082,8 @@
         return( MBEDTLS_ERR_ECP_BUFFER_TOO_SMALL );
     q = p + 2 + oid_length;
     *olen = mbedtls_asn1_write_oid( &q, p, oid, oid_length );
+    if ( p != q )
+        return ( MBEDTLS_ERR_ECP_BAD_INPUT_DATA );
     return ( 0 );
 }