commit | d707bc026f9a043ae14e87cec3ccdcb50b7a16a8 | [log] [tgz] |
---|---|---|
author | David Benjamin <davidben@google.com> | Thu Feb 25 19:07:09 2021 -0500 |
committer | Adam Langley <agl@google.com> | Fri Feb 26 17:32:57 2021 +0000 |
tree | 9a312865cae0cd5d5fba05fb3323f5c6a2af0b6f | |
parent | 565226278d6b863672bb5c3f24197d8bb6e58b50 [diff] |
Handle the default X.509 version explicitly. This is a no-op, but relying on ASN1_INTEGER_get's internal handling of NULL is confusing. Change-Id: I49ab38c170d2f39fd3a4780b8c44b103a2ba4615 Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/45924 Reviewed-by: Adam Langley <agl@google.com>
diff --git a/crypto/x509/x509_set.c b/crypto/x509/x509_set.c index 5f17851..9193b20 100644 --- a/crypto/x509/x509_set.c +++ b/crypto/x509/x509_set.c
@@ -62,6 +62,10 @@ long X509_get_version(const X509 *x509) { + // The default version is v1(0). + if (x509->cert_info->version == NULL) { + return 0; + } return ASN1_INTEGER_get(x509->cert_info->version); }