From 8dc1de3acb86375830e7034cab419030bdf1d36b Mon Sep 17 00:00:00 2001 From: Ingo Klöcker Date: Wed, 5 Aug 2026 12:17:31 +0200 Subject: Fix handling of missing timestamp in SIGINFO status * src/verify.c (parse_sig_info): Add argument protocol. Check for "-" if protocol is CMS. (_gpgme_verify_status_handler): Pass protocol to parse_sig_info. * tests/gpg/t-verify.c (check_result): Add argument timestamp. Check timestamp. (main): Add expected timestamp to all check_result calls. * tests/gpgsm/t-verify.c (check_result): Add argument timestamp. Check timestamp. (main): Add expected timestamp to all check_result calls. -- S/MIME signatures do not necessarily have a timestamp. In this case gpgsm emits "-" in the SIGINFO status line. Fixes-commit: 31eb884e8f102ed3cf1220ccdd77e6e1931a9a7b GnuPG-bug-id: 8368 --- src/verify.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/verify.c b/src/verify.c index d221c30e..f97c255f 100644 --- a/src/verify.c +++ b/src/verify.c @@ -491,7 +491,7 @@ parse_valid_sig (gpgme_signature_t sig, char *args, gpgme_protocol_t protocol) static gpgme_error_t -parse_sig_info (gpgme_signature_t sig, char *args) +parse_sig_info (gpgme_signature_t sig, char *args, gpgme_protocol_t protocol) { char *end = args; char *tail; @@ -500,6 +500,9 @@ parse_sig_info (gpgme_signature_t sig, char *args) /* We require at least the creation time. */ return gpg_error (GPG_ERR_GENERAL); + if ((protocol == GPGME_PROTOCOL_CMS) && (*args == '-')) + return 0; + sig->timestamp = _gpgme_parse_timestamp (end, &tail); if (sig->timestamp == -1 || end == tail || (*tail && *tail != ' ')) return trace_gpg_error (GPG_ERR_INV_ENGINE); @@ -1036,7 +1039,7 @@ _gpgme_verify_status_handler (void *priv, gpgme_status_code_t code, char *args) case GPGME_STATUS_SIGINFO: opd->only_newsig_seen = 0; - return sig ? parse_sig_info (sig, args) + return sig ? parse_sig_info (sig, args, ctx->protocol) : trace_gpg_error (GPG_ERR_INV_ENGINE); case GPGME_STATUS_NODATA: -- cgit