Skip to content

Commit

Permalink
Merge pull request #56 from ejoerns/v0/topic/cms_error_reporting
Browse files Browse the repository at this point in the history
signature: obtain verbose error string for CMS_verify() failures
  • Loading branch information
jluebbe committed Jun 24, 2016
2 parents 29d4771 + 721e209 commit d12cf6f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/signature.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,15 @@ gboolean cms_verify(GBytes *content, GBytes *sig, GError **error) {
}

if (!CMS_verify(cms, other, store, incontent, NULL, CMS_DETACHED)) {
unsigned long err;
const gchar *data;
int flags;
err = ERR_get_error_line_data(NULL, NULL, &data, &flags);
g_set_error(
error,
R_SIGNATURE_ERROR,
R_SIGNATURE_ERROR_INVALID,
"invalid signature");
"signature verification failed: %s", (flags & ERR_TXT_STRING) ? data : ERR_error_string(err, NULL));
goto out;
}

Expand Down

0 comments on commit d12cf6f

Please sign in to comment.