ec-info: Overhaul elliptic curve domain parameter checking.
* Separate out the common parts of prime and binary curve checking into
its own function.
* Replace the cofactor checking with a new, rather more complicated,
algorithm which verifies that it has the correct value without
needing an explicit square-root. Also allow larger cofactors; it's
not our responsibility to avoid small-subgroup attacks.
* Replace the embedding-degree check with one that's rather more
enlightened. Unfortunately, it has to intuit the desired security
level, and that's not going to work well.
Also check for memory leaks in the test harness (one snuck in during
development and was caught by another test).