move the NID_undef check for EC named curve
Merge pull request #1539 from reaperhulk/move-ec-named-curve-check

move the NID_undef check for EC named curve