Avoid EVP_PKEY_cmp() crash on EC keys without public component
authorDavid Woodhouse <David.Woodhouse@intel.com>
Wed, 7 Sep 2016 15:53:18 +0000 (16:53 +0100)
committerDavid Woodhouse <David.Woodhouse@intel.com>
Wed, 7 Sep 2016 17:21:32 +0000 (18:21 +0100)
commit92ed7fa575a80955f3bb6efefca9bf576a953586
treec758cb8748c9f9266f8b69fe92e08e56e44ae169
parent79e5eae6ab164efe4966685758b8f15c13698bb1
Avoid EVP_PKEY_cmp() crash on EC keys without public component

Some hardware devices don't provide the public EC_POINT data. The only
way for X509_check_private_key() to validate that the key matches a
given certificate is to actually perform a sign operation and then
verify it using the public key in the certificate.

Maybe that can come later, as discussed in issue 1532. But for now let's
at least make it fail gracefully and not crash.

GH: 1532

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1547)
crypto/ec/ec_ameth.c