Admit unknown pkey types at security level 0
authorKen Goldman <kgoldman@us.ibm.com>
Fri, 14 Dec 2018 20:04:04 +0000 (15:04 -0500)
committerViktor Dukhovni <openssl-users@dukhovni.org>
Thu, 20 Dec 2018 08:10:55 +0000 (03:10 -0500)
commitea7d2c5808f4711edfdd25a7a4e2e39f8ee3de62
tree2f448d2cf090806ffc122464510dc22e5771fb6e
parentbb157fd142ab3eced6051a32d8207de8a79c2fbe
Admit unknown pkey types at security level 0

The check_key_level() function currently fails when the public key
cannot be extracted from the certificate because its algorithm is not
supported.  However, the public key is not needed for the last
certificate in the chain.

This change moves the check for level 0 before the check for a
non-NULL public key.

For background, this is the TPM 1.2 endorsement key certificate.
I.e., this is a real application with millions of certificates issued.
The key is an RSA-2048 key.

The TCG (for a while) specified

     Public Key Algorithm: rsaesOaep

rather than the commonly used

     Public Key Algorithm: rsaEncryption

because the key is an encryption key rather than a signing key.
The X509 certificate parser fails to get the public key.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7906)
crypto/x509/x509_vfy.c