Fix CRL printing to correctly show when there are no revoked certificates.

Make ca.c correctly initialize the revocation date.

Make ASN1_UTCTIME_set_string() and ASN1_GENERALIZEDTIME_set_string() set the
string type: so they can initialize ASN1_TIME structures properly.
diff --git a/CHANGES b/CHANGES
index 227de87..0325df3 100644
--- a/CHANGES
+++ b/CHANGES
@@ -3,6 +3,11 @@
 
  Changes between 0.9.6 and 0.9.7  [xx XXX 2000]
 
+  *) Make ASN1_UTCTIME_set_string() and ASN1_GENERALIZEDTIME_set_string()
+     set string type: to handle setting ASN1_TIME structures. Fix ca
+     utility to correctly initialize revocation date of CRLs.
+     [Steve Henson]
+
   *) New option SSL_OP_CIPHER_SERVER_PREFERENCE allows the server to override
      the clients preferred ciphersuites and rather use its own preferences.
      Should help to work around M$ SGC (Server Gated Cryptography) bug in
diff --git a/apps/ca.c b/apps/ca.c
index 567ef47..b84e842 100644
--- a/apps/ca.c
+++ b/apps/ca.c
@@ -1379,10 +1379,9 @@
 			if (pp[DB_type][0] == DB_TYPE_REV)
 				{
 				if ((r=X509_REVOKED_new()) == NULL) goto err;
-				ASN1_STRING_set((ASN1_STRING *)
-					r->revocationDate,
-					(unsigned char *)pp[DB_rev_date],
-					strlen(pp[DB_rev_date]));
+				if (!ASN1_UTCTIME_set_string(r->revocationDate,
+					pp[DB_rev_date]))
+						goto err;
 				/* strcpy(r->revocationDate,pp[DB_rev_date]);*/
 
 				(void)BIO_reset(hex);
diff --git a/crypto/asn1/a_gentm.c b/crypto/asn1/a_gentm.c
index d71c190..f884b25 100644
--- a/crypto/asn1/a_gentm.c
+++ b/crypto/asn1/a_gentm.c
@@ -180,6 +180,7 @@
 			{
 			ASN1_STRING_set((ASN1_STRING *)s,
 				(unsigned char *)str,t.length);
+			s->type=V_ASN1_GENERALIZEDTIME;
 			}
 		return(1);
 		}
diff --git a/crypto/asn1/a_utctm.c b/crypto/asn1/a_utctm.c
index 6ddeaff..7cb6464 100644
--- a/crypto/asn1/a_utctm.c
+++ b/crypto/asn1/a_utctm.c
@@ -179,6 +179,7 @@
 			{
 			ASN1_STRING_set((ASN1_STRING *)s,
 				(unsigned char *)str,t.length);
+			s->type = V_ASN1_UTCTIME;
 			}
 		return(1);
 		}
diff --git a/crypto/asn1/t_crl.c b/crypto/asn1/t_crl.c
index f7b938b..ab9cd8f 100644
--- a/crypto/asn1/t_crl.c
+++ b/crypto/asn1/t_crl.c
@@ -112,7 +112,7 @@
 
 	rev = X509_CRL_get_REVOKED(x);
 
-	if(sk_X509_REVOKED_num(rev))
+	if(sk_X509_REVOKED_num(rev) > 0)
 	    BIO_printf(out, "Revoked Certificates:\n");
 	else BIO_printf(out, "No Revoked Certificates.\n");