aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/x509/x509_set.c
diff options
context:
space:
mode:
authorGeoff Keating <geoffk@apple.com>2014-09-09 14:28:54 -0400
committerRich Salz <rsalz@openssl.org>2014-09-09 15:15:45 -0400
commit1f18f50c4b0711ebe4a20038d324c0de5dce4512 (patch)
treee19381e709674e7c3890139dfe006e8046d083d2 /crypto/x509/x509_set.c
parent4eadd11cd97ad359a2207e8e554d9fc84fce1110 (diff)
downloadopenssl-1f18f50c4b0711ebe4a20038d324c0de5dce4512.tar.gz
RT1909: Omit version for v1 certificates
When calling X509_set_version to set v1 certificate, that should mean that the version number field is omitted. Reviewed-by: Dr. Stephen Henson <steve@openssl.org>
Diffstat (limited to 'crypto/x509/x509_set.c')
-rw-r--r--crypto/x509/x509_set.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/crypto/x509/x509_set.c b/crypto/x509/x509_set.c
index 4b94fc5847..d37adb1fbf 100644
--- a/crypto/x509/x509_set.c
+++ b/crypto/x509/x509_set.c
@@ -66,6 +66,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)