blob: e3fb1e54c1142d3bbff132256291843bb08b1849 [file] [log] [blame]
jcat-context: don't fail verification if compiled without an engine
libjcat can be compiled with both gpg and pkcs7, but if it's compiled
without one then blobs signed with both can't be verified.
https://github.com/hughsie/libjcat/pull/43
https://github.com/hughsie/libjcat/pull/44
diff --git a/libjcat/jcat-context.c b/libjcat/jcat-context.c
index 095701e..b27d3a4 100644
--- a/libjcat/jcat-context.c
+++ b/libjcat/jcat-context.c
@@ -270,13 +270,16 @@ jcat_context_verify_item (JcatContext *self,
/* all checksum engines must verify */
for (guint i = 0; i < blobs->len; i++) {
JcatBlob *blob = g_ptr_array_index (blobs, i);
+ g_autoptr(GError) error_local = NULL;
g_autoptr(JcatEngine) engine = NULL;
g_autoptr(JcatResult) result = NULL;
/* get engine */
- engine = jcat_context_get_engine (self, jcat_blob_get_kind (blob), error);
- if (engine == NULL)
- return NULL;
+ engine = jcat_context_get_engine (self, jcat_blob_get_kind (blob), &error_local);
+ if (engine == NULL) {
+ g_debug ("%s", error_local->message);
+ continue;
+ }
if (jcat_engine_get_verify_kind (engine) != JCAT_ENGINE_VERIFY_KIND_CHECKSUM)
continue;
result = jcat_engine_self_verify (engine, data, jcat_blob_get_data (blob), flags, error);
@@ -302,9 +305,11 @@ jcat_context_verify_item (JcatContext *self,
g_autoptr(JcatEngine) engine = NULL;
g_autoptr(JcatResult) result = NULL;
- engine = jcat_context_get_engine (self, jcat_blob_get_kind (blob), error);
- if (engine == NULL)
- return NULL;
+ engine = jcat_context_get_engine (self, jcat_blob_get_kind (blob), &error_local);
+ if (engine == NULL) {
+ g_debug ("%s", error_local->message);
+ continue;
+ }
if (jcat_engine_get_verify_kind (engine) != JCAT_ENGINE_VERIFY_KIND_SIGNATURE)
continue;
result = jcat_engine_pubkey_verify (engine, data, jcat_blob_get_data (blob), flags, &error_local);