KEYS: X.509: Parse Basic Constraints for CA
authorEric Snowberg <eric.snowberg@oracle.com>
Thu, 2 Mar 2023 16:46:49 +0000 (11:46 -0500)
committerJarkko Sakkinen <jarkko@kernel.org>
Mon, 24 Apr 2023 13:15:53 +0000 (16:15 +0300)
commit30eae2b037af54b24109dcaea21db46f6285c69b
tree0a637a2bbeb78b4d2c106fce957c276c2dab6a8e
parentef97e774713fcd34c45f7a7426c7d8845394f7be
KEYS: X.509: Parse Basic Constraints for CA

Parse the X.509 Basic Constraints.  The basic constraints extension
identifies whether the subject of the certificate is a CA.

BasicConstraints ::= SEQUENCE {
        cA                      BOOLEAN DEFAULT FALSE,
        pathLenConstraint       INTEGER (0..MAX) OPTIONAL }

If the CA is true, store it in the public_key.  This will be used
in a follow on patch that requires knowing if the public key is a CA.

Link: https://www.rfc-editor.org/rfc/rfc5280#section-4.2.1.9
Signed-off-by: Eric Snowberg <eric.snowberg@oracle.com>
Reviewed-by: Mimi Zohar <zohar@linux.ibm.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Tested-by: Mimi Zohar <zohar@linux.ibm.com>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
crypto/asymmetric_keys/x509_cert_parser.c
include/crypto/public_key.h