From: Stef Walter Date: Wed, 23 Dec 2009 16:28:22 +0000 (+0000) Subject: [egg] Some more minor fixes for parsing certificates. X-Git-Tag: split~265^2~10 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f01619015f87bdb0d9b2d5de18b55448b5874cf0;p=platform%2Fupstream%2Fgcr.git [egg] Some more minor fixes for parsing certificates. --- 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 ();