summaryrefslogtreecommitdiffstats
path: root/apps/lib/apps.c
diff options
context:
space:
mode:
authorDavid Benjamin <davidben@google.com>2021-03-11 14:43:04 -0500
committerTomas Mraz <tomas@openssl.org>2021-04-28 11:40:06 +0200
commitcdf63a3736a91a534bd3bc952b1dc3ef714604dd (patch)
treef1c2986418c09bd6a8933d024475ede09f44c687 /apps/lib/apps.c
parentd97adfda2868aeb9e62df96216203e8120a95d6d (diff)
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)
Diffstat (limited to 'apps/lib/apps.c')
-rw-r--r--apps/lib/apps.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/apps/lib/apps.c b/apps/lib/apps.c
index e39e7cd061..4b7b38cf5c 100644
--- a/apps/lib/apps.c
+++ b/apps/lib/apps.c
@@ -2209,7 +2209,7 @@ int do_X509_sign(X509 *cert, EVP_PKEY *pkey, const EVP_MD *md,
if (sk_X509_EXTENSION_num(exts /* may be NULL */) > 0) {
/* Prevent X509_V_ERR_EXTENSIONS_REQUIRE_VERSION_3 */
- if (!X509_set_version(cert, 2)) /* Make sure cert is X509 v3 */
+ if (!X509_set_version(cert, X509_VERSION_3))
goto end;
/*