[gnome-keyring/asn1-work: 8/18] [egg] Some more minor fixes for parsing certificates.



commit 23fd886490a00829a6a1e26ddf0eba2ad82a97ce
Author: Stef Walter <stef memberwebs com>
Date:   Wed Dec 23 16:28:22 2009 +0000

    [egg] Some more minor fixes for parsing certificates.

 egg/egg-asn1x.c        |    5 ++---
 egg/tests/test-asn1x.c |    8 ++++----
 2 files changed, 6 insertions(+), 7 deletions(-)
---
diff --git a/egg/egg-asn1x.c b/egg/egg-asn1x.c
index 62a30a3..a03b977 100644
--- a/egg/egg-asn1x.c
+++ b/egg/egg-asn1x.c
@@ -459,10 +459,8 @@ anode_decode_choice (GNode *node, const guchar *data, gsize n_data)
 
 	for (child = node->children; child; child = child->next) {
 		off = anode_decode_anything (child, data, n_data);
-		if (off >= 0) {
-			g_return_val_if_fail (off == n_data, -1);
+		if (off >= 0)
 			return off;
-		}
 	}
 
 	return -1;
@@ -742,6 +740,7 @@ anode_decode_explicit_or_type (GNode *node, const guchar *data, gsize n_data)
 			if (len <= 0 || off + len > n_data)
 				return -1;
 		}
+
 		return off + len;
 	}
 
diff --git a/egg/tests/test-asn1x.c b/egg/tests/test-asn1x.c
index 330a18e..983a79f 100644
--- a/egg/tests/test-asn1x.c
+++ b/egg/tests/test-asn1x.c
@@ -17,16 +17,16 @@ run (void)
 	gpointer data;
 	gsize n_data;
 
-	data = testing_data_read ("test-pkcs12-1.der", &n_data);
-	asn = egg_asn1x_create (pkix_asn1_tab, "pkcs-12-PFX");
+	data = testing_data_read ("test-certificate-1.der", &n_data);
+	asn = egg_asn1x_create (pkix_asn1_tab, "Certificate");
 	egg_asn1x_dump (asn);
 	if (!egg_asn1x_decode (asn, data, n_data))
 		g_assert_not_reached ();
 	egg_asn1x_destroy (asn);
 	g_free (data);
 
-	data = testing_data_read ("test-certificate-1.der", &n_data);
-	asn = egg_asn1x_create (pkix_asn1_tab, "Certificate");
+	data = testing_data_read ("test-pkcs12-1.der", &n_data);
+	asn = egg_asn1x_create (pkix_asn1_tab, "pkcs-12-PFX");
 	egg_asn1x_dump (asn);
 	if (!egg_asn1x_decode (asn, data, n_data))
 		g_assert_not_reached ();



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]