Fix CRL encoding bug.
authorDr. Stephen Henson <steve@openssl.org>
Sat, 29 Jan 2000 00:00:26 +0000 (00:00 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Sat, 29 Jan 2000 00:00:26 +0000 (00:00 +0000)
CHANGES
crypto/asn1/x_crl.c

diff --git a/CHANGES b/CHANGES
index dbbce58e1ed799685143022fdeaa3972db0dcc97..9f3af3ace4e3ca56b1df2f46c04aac7e50f6a0b3 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -4,6 +4,10 @@
 
  Changes between 0.9.4 and 0.9.5  [xx XXX 2000]
 
+  *) Fix for bug in CRL encoding. The validity dates weren't being handled
+     as ASN1_TIME.
+     [Steve Henson]
+
   *) New -pkcs12 option to CA.pl script to write out a PKCS#12 file.
      [Steve Henson]
 
index 6755cd610424941d06148e342e691d169e3207e2..12a42d04c75b1c18548181ff9c82a2ccdaee1c77 100644 (file)
@@ -130,9 +130,9 @@ int i2d_X509_CRL_INFO(X509_CRL_INFO *a, unsigned char **pp)
                }
        M_ASN1_I2D_put(a->sig_alg,i2d_X509_ALGOR);
        M_ASN1_I2D_put(a->issuer,i2d_X509_NAME);
-       M_ASN1_I2D_put(a->lastUpdate,i2d_ASN1_UTCTIME);
+       M_ASN1_I2D_put(a->lastUpdate,i2d_ASN1_TIME);
        if (a->nextUpdate != NULL)
-               { M_ASN1_I2D_put(a->nextUpdate,i2d_ASN1_UTCTIME); }
+               { M_ASN1_I2D_put(a->nextUpdate,i2d_ASN1_TIME); }
        M_ASN1_I2D_put_SEQUENCE_opt_type(X509_REVOKED,a->revoked,
                                         i2d_X509_REVOKED);
        M_ASN1_I2D_put_EXP_SEQUENCE_opt_type(X509_EXTENSION,a->extensions,
@@ -164,13 +164,9 @@ X509_CRL_INFO *d2i_X509_CRL_INFO(X509_CRL_INFO **a, unsigned char **pp,
        M_ASN1_D2I_get(ret->issuer,d2i_X509_NAME);
        M_ASN1_D2I_get(ret->lastUpdate,d2i_ASN1_TIME);
        /* Manually handle the OPTIONAL ASN1_TIME stuff */
-       if(c.slen != 0
-          && ( (M_ASN1_next & ~V_ASN1_CONSTRUCTED) ==
-                   (V_ASN1_UNIVERSAL|V_ASN1_UTCTIME)
-               || (M_ASN1_next & ~V_ASN1_CONSTRUCTED) ==
-                   (V_ASN1_UNIVERSAL|V_ASN1_GENERALIZEDTIME) ) ) {
-               M_ASN1_D2I_get(ret->nextUpdate,d2i_ASN1_TIME);
-       }
+       /* First try UTCTime */
+       M_ASN1_D2I_get_opt(ret->nextUpdate,d2i_ASN1_UTCTIME, V_ASN1_UTCTIME);
+       /* If that doesn't work try GeneralizedTime */
        if(!ret->nextUpdate) 
                M_ASN1_D2I_get_opt(ret->nextUpdate,d2i_ASN1_GENERALIZEDTIME,
                                                        V_ASN1_GENERALIZEDTIME);