summaryrefslogtreecommitdiffstats
path: root/test
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 /test
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 'test')
-rw-r--r--test/v3nametest.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/test/v3nametest.c b/test/v3nametest.c
index e1eeb75f2f..d11077fb3d 100644
--- a/test/v3nametest.c
+++ b/test/v3nametest.c
@@ -257,7 +257,7 @@ static X509 *make_cert(void)
if (!TEST_ptr(crt = X509_new()))
return NULL;
- if (!TEST_true(X509_set_version(crt, 2))) {
+ if (!TEST_true(X509_set_version(crt, X509_VERSION_3))) {
X509_free(crt);
return NULL;
}