Add X509 version constants.
authorDavid Benjamin <davidben@google.com>
Thu, 11 Mar 2021 19:43:04 +0000 (14:43 -0500)
committerTomas Mraz <tomas@openssl.org>
Wed, 28 Apr 2021 09:40:06 +0000 (11:40 +0200)
commitcdf63a3736a91a534bd3bc952b1dc3ef714604dd
treef1c2986418c09bd6a8933d024475ede09f44c687
parentd97adfda2868aeb9e62df96216203e8120a95d6d
Add X509 version constants.

The X509 version APIs return the numerical values of the version
numbers, which are one off from the names. This is a bit confusing.
Where they don't get it wrong (accidentally making an "X509v4"
certificate), callers tend to try commenting every call site to explain
the mismatch, including in OpenSSL itself.

Define constants for these values, so code can be self-documenting and
callers are nudged towards the right values.

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14549)
12 files changed:
apps/ca.c
apps/lib/apps.c
apps/req.c
crypto/x509/t_crl.c
crypto/x509/t_req.c
crypto/x509/t_x509.c
crypto/x509/v3_purp.c
crypto/x509/x509_cmp.c
crypto/x509/x509_vfy.c
doc/man3/X509_get_version.pod
include/openssl/x509.h.in
test/v3nametest.c