Check that the specified curve is one of the client preferences.

Based on OpenSSL.

ok miod@
There is not much point checking ecdhp is not NULL... twice.

ok miod@