From: Geoff Keating Date: Tue, 9 Sep 2014 18:28:54 +0000 (-0400) Subject: RT1909: Omit version for v1 certificates X-Git-Tag: OpenSSL_1_0_2-beta3~38 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=8c0d19d8577c9a96b65622bfa92d0affd6bbb4ac;p=oweals%2Fopenssl.git 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 (cherry picked from commit 1f18f50c4b0711ebe4a20038d324c0de5dce4512) --- 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)