Add test for empty CRL

Change-Id: Ie8b099eec5628e5c577cff23050431d4ed1e2be2
diff --git a/luni/src/test/java/libcore/java/security/cert/X509CRLTest.java b/luni/src/test/java/libcore/java/security/cert/X509CRLTest.java
index b829d2d..fa920ce 100644
--- a/luni/src/test/java/libcore/java/security/cert/X509CRLTest.java
+++ b/luni/src/test/java/libcore/java/security/cert/X509CRLTest.java
@@ -70,6 +70,8 @@
 
     private static final String CRL_RSA_TBS = "x509/crl-rsa-tbs.der";
 
+    private static final String CRL_EMPTY = "x509/crl-empty.der";
+
     private final X509Certificate getCertificate(CertificateFactory f, String name)
             throws Exception {
         final InputStream is = Support_Resources.getStream(name);
@@ -349,6 +351,9 @@
     }
 
     private void getRevokedCertificates(CertificateFactory f) throws Exception {
+        X509CRL crlEmpty = getCRL(f, CRL_EMPTY);
+        assertNull(crlEmpty.getRevokedCertificates());
+
         X509CRL crlRsa = getCRL(f, CRL_RSA);
         X509Certificate rsaCert = getCertificate(f, CERT_RSA);
         X509Certificate dsaCert = getCertificate(f, CERT_DSA);
diff --git a/support/src/test/java/tests/resources/x509/create.sh b/support/src/test/java/tests/resources/x509/create.sh
index 0f7cb81..8362fab 100755
--- a/support/src/test/java/tests/resources/x509/create.sh
+++ b/support/src/test/java/tests/resources/x509/create.sh
@@ -80,6 +80,9 @@
 openssl req -new -nodes -batch -x509 -extensions v3_ca -keyout cakey.pem -out cacert.pem -days 3650 -config default.cnf
 openssl x509 -in cacert.pem -outform d > cert-crl-ca.der
 
+openssl ca -gencrl -crlhours 70 -keyfile cakey.pem -cert cacert.pem -out crl-empty.pem -config default.cnf
+openssl crl -in crl-empty.pem -outform d -out crl-empty.der
+
 openssl x509 -inform d -in cert-rsa.der -out cert-rsa.pem
 openssl ca -revoke cert-rsa.pem -keyfile cakey.pem -cert cacert.pem -config default.cnf
 openssl ca -gencrl -crlhours 70 -keyfile cakey.pem -cert cacert.pem -out crl-rsa.pem -config default.cnf
@@ -103,7 +106,7 @@
 openssl crl -inform d -in crl-rsa.der -noout -lastupdate -nextupdate > crl-rsa-dates.txt
 openssl crl -inform d -in crl-rsa-dsa.der -noout -lastupdate -nextupdate > crl-rsa-dsa-dates.txt
 
-rm -f cert-rsa.pem cert-dsa.pem cacert.pem cakey.pem crl-rsa.pem crl-rsa-dsa.pem crl-unsupported.pem
+rm -f cert-rsa.pem cert-dsa.pem cacert.pem cakey.pem crl-rsa.pem crl-rsa-dsa.pem crl-unsupported.pem crl-empty.pem
 rm -rf /tmp/ca
 
 rm -f privkey.pem
diff --git a/support/src/test/java/tests/resources/x509/crl-empty.der b/support/src/test/java/tests/resources/x509/crl-empty.der
new file mode 100644
index 0000000..c5d21a4
--- /dev/null
+++ b/support/src/test/java/tests/resources/x509/crl-empty.der
Binary files differ