crypto: Fix malloc mixing in X509ToObject
EC_KEY_key2buf returns an OPENSSL_malloc'd pointer so it shouldn't be passed into Buffer::New, which expect a libc malloc'd pointer. Instead, mirror the ECDH::GetPublicKey code and use EC_POINT_point2oct.
This preserves the existing behavior where encoding failures are silently ignored, but it is probably safe to CHECK fail them instead (whichever you all prefer).
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
commit message follows commit guidelines