diff options
author | Adam Langley <agl@google.com> | 2014-11-04 05:58:36 +0300 |
---|---|---|
committer | Adam Langley <agl@google.com> | 2014-11-11 00:45:32 +0300 |
commit | fba236fa8810957d97500e654189a8e31bd91909 (patch) | |
tree | 78ff4c192677266be061d564b390432ba98d0d62 /crypto/x509 | |
parent | 920e69658e93a96c4a5dfabd13596a34c5a69e31 (diff) |
Omit version for v1 certificates.
When calling X509_set_version to set v1 certificate, that should mean
that the version number field is omitted.
(Imported from upstream's 8c0d19d8577c9a96b65622bfa92d0affd6bbb4ac)
Change-Id: If433fda7b6ccbd899f3379a38581c351cf4a82da
Diffstat (limited to 'crypto/x509')
-rw-r--r-- | crypto/x509/x509_set.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/crypto/x509/x509_set.c b/crypto/x509/x509_set.c index 4288571d..06658b07 100644 --- a/crypto/x509/x509_set.c +++ b/crypto/x509/x509_set.c @@ -64,6 +64,12 @@ int X509_set_version(X509 *x, long version) { if (x == NULL) return(0); + if (version == 0) + { + M_ASN1_INTEGER_free(x->cert_info->version); + x->cert_info->version = NULL; + return(1); + } if (x->cert_info->version == NULL) { if ((x->cert_info->version=M_ASN1_INTEGER_new()) == NULL) |