summaryrefslogtreecommitdiffstats
path: root/apps/req.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/req.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/req.c')
-rw-r--r--apps/req.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/apps/req.c b/apps/req.c
index 89bde55b93..0a524118f0 100644
--- a/apps/req.c
+++ b/apps/req.c
@@ -1117,7 +1117,8 @@ static int make_REQ(X509_REQ *req, EVP_PKEY *pkey, X509_NAME *fsubj,
}
}
- if (!X509_REQ_set_version(req, 0L)) /* so far there is only version 1 */
+ /* so far there is only version 1 */
+ if (!X509_REQ_set_version(req, X509_REQ_VERSION_1))
goto err;
if (fsubj != NULL)